re-compile error

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • developer

    #1

    re-compile error

    re-compile under dev -c++ bloodshed.

    can u help ?


    #include<dos.h>
    #include<proces s.h>
    #include<io.h>
    #include<stdio. h>
    #define STROBE 0x01
    #define NOT_STB 0x00

    void main()
    {
    char i,j;
    unsigned int CTRL_PORT,STAR_ PORT;
    unsigned int far *DATA_PORT;
    DATA_PORT=MK_FP (0x0000,0x0408) ;
    STAR_PORT=*DATA _PORT+1;
    CTRL_PORT=STAR_ PORT+1;
    outport(CTRL_PO RT,0x00);
    while(1)
    {
    outport(*DATA_P ORT,0x00);
    delay(2000);
    outport(*DATA_P ORT,0xff);
    delay(2000);
    outport(*DATA_P ORT,0x00);
    delay(2000);
    j=0x80;
    for(i=0;i<8;i++ )
    {
    outport(*DATA_P ORT,j);
    j=j>>1;
    delay(2000);
    }
    }
    }


    Compiler: Default compiler
    Executing gcc.exe...
    gcc.exe "C:\Documen ts and Settings\farm\T EST.C" -o "C:\Documen ts and
    Settings\farm\T EST.exe" -g3 -I"C:\Dev-Cpp\include" -L"C:\Dev-Cpp\lib"
    C:/Documents and Settings/farm/TEST.C:9: `main' must return `int'
    C:/Documents and Settings/farm/TEST.C: In function `int main(...)':
    C:/Documents and Settings/farm/TEST.C:12: parse error before `*'
    token
    C:/Documents and Settings/farm/TEST.C:13: `DATA_PORT' undeclared
    (first use this function)
    C:/Documents and Settings/farm/TEST.C:13: (Each undeclared
    identifier is reported only once for each function it appears in.)
    C:/Documents and Settings/farm/TEST.C:13: `MK_FP' undeclared (first
    use this function)
    C:/Documents and Settings/farm/TEST.C:16: `outport' undeclared
    (first use this function)
    C:/Documents and Settings/farm/TEST.C:20: `delay' undeclared (first
    use this function)

    C:/Documents and Settings/farm/TEST.C: At global scope:
    C:/Documents and Settings/farm/TEST.C:33: stray '\32' in program

    C:/Documents and Settings/farm/TEST.C:33:3: warning: no newline at end of
    file

    Execution terminated


  • Jens.Toerring@physik.fu-berlin.de

    #2
    Re: re-compile error

    developer <noemail@sina.c om> wrote:[color=blue]
    > re-compile under dev -c++ bloodshed.[/color]
    [color=blue]
    > can u help ?[/color]

    Not really...
    [color=blue]
    > #include<dos.h>
    > #include<proces s.h>
    > #include<io.h>[/color]

    All these three are non-standard header files, probably available
    on DOS based machines. To find help about them you have to ask in
    a different group that deals with Microsoft-specific extensions to
    the C language.
    [color=blue]
    > #include<stdio. h>
    > #define STROBE 0x01
    > #define NOT_STB 0x00[/color]
    [color=blue]
    > void main()[/color]

    main() must return an int.
    [color=blue]
    > {
    > char i,j;
    > unsigned int CTRL_PORT,STAR_ PORT;
    > unsigned int far *DATA_PORT;[/color]

    The 'far' isn't standard C - it's usually found in old DOS programs.
    A normal C compiler won't know what to do with it and assume that
    you want to define an unsigned int variable called 'far' and choke
    on what follows. Again, you need to ask in a MS-group to get help
    about that.
    [color=blue]
    > DATA_PORT=MK_FP (0x0000,0x0408) ;[/color]

    Because of the problem with the previous line DATA_PORT isn't
    defined. And obviously the compiler doesn't know what MK_FP()
    is supposed to be. It's not a standard C function and it doesn't
    seem to be defined in the non-standard headers you included above,
    at least the compiler tells you it hasn't found it in there.
    [color=blue]
    > STAR_PORT=*DATA _PORT+1;
    > CTRL_PORT=STAR_ PORT+1;
    > outport(CTRL_PO RT,0x00);[/color]

    outport() isn't a standard C function and doesn't seem to be declared
    in the the non-standard headers.
    [color=blue]
    > while(1)
    > {
    > outport(*DATA_P ORT,0x00);
    > delay(2000);[/color]

    And again the same problem with the delay() function.
    [color=blue]
    > outport(*DATA_P ORT,0xff);
    > delay(2000);
    > outport(*DATA_P ORT,0x00);
    > delay(2000);
    > j=0x80;
    > for(i=0;i<8;i++ )
    > {
    > outport(*DATA_P ORT,j);
    > j=j>>1;
    > delay(2000);
    > }
    > }[/color]

    You're missing a statement like "return 0;" here - since main() is
    supposed to return an int you must do so.
    [color=blue]
    > }[/color]

    The last character in a regular C program must be a line feed. The ^Z
    stuff is an abomination from very old DOS programs where it was meant
    to indicate the end of the file. Normal compilers will choke on it.

    Most of your problems seem to be due to the use of non-standard (DOS)
    extensions. So you better go to a group that deals with MS specific
    stuff. It probably would make sense also there to explain on what kind
    of system you want to compile and run that program - I suspect that
    even a newer Windows system wouldn't let you run that even if you get
    it to compile and link.
    Regards, Jens
    --
    \ Jens Thoms Toerring ___ Jens.Toerring@p hysik.fu-berlin.de
    \______________ ____________ http://www.toerring.de

    Comment

    • Flash Gordon

      #3
      Re: re-compile error

      On Mon, 13 Dec 2004 18:26:57 +0800
      "developer" <noemail@sina.c om> wrote:
      [color=blue]
      > re-compile under dev -c++ bloodshed.
      >
      > can u help ?[/color]

      Well, you dealing with the obvious things the compiler is telling you
      would have been a start.
      [color=blue]
      > #include<dos.h>
      > #include<proces s.h>
      > #include<io.h>[/color]

      The above are non-standard headers and here we have no idea what they
      contain.
      [color=blue]
      > #include<stdio. h>
      > #define STROBE 0x01
      > #define NOT_STB 0x00
      >
      > void main()[/color]

      As your compiler correctly tells you main returns an int so you should
      declare it as such.

      int main(void)

      since you don't use the parameters.[color=blue]
      > {
      > char i,j;[/color]

      Some indentation would be a good idea.
      [color=blue]
      > unsigned int CTRL_PORT,STAR_ PORT;[/color]

      Common convention is to use lower case for variable names and upper case
      for macros.
      [color=blue]
      > unsigned int far *DATA_PORT;[/color]

      What is the far of which you speak? It certainly is not a standard C
      keyword.

      <OT>
      This suggests the code was written for an ancient DOS compiler, since
      far was a completely non-standard extention that some DOS compilers used
      to provide.
      [color=blue]
      > DATA_PORT=MK_FP (0x0000,0x0408) ;[/color]

      What is the MK_FP of which you speak? It is not declared in your
      program, so unless it comes from your non-standard headers it does not
      exist. Since your compiler complains I would suggest it does not exist.
      [color=blue]
      > STAR_PORT=*DATA _PORT+1;
      > CTRL_PORT=STAR_ PORT+1;
      > outport(CTRL_PO RT,0x00);[/color]

      Same applies here. As far as we can see outport does not exist just as
      your compiler suggests.
      [color=blue]
      > while(1)
      > {
      > outport(*DATA_P ORT,0x00);
      > delay(2000);
      > outport(*DATA_P ORT,0xff);
      > delay(2000);
      > outport(*DATA_P ORT,0x00);
      > delay(2000);
      > j=0x80;
      > for(i=0;i<8;i++ )
      > {
      > outport(*DATA_P ORT,j);
      > j=j>>1;[/color]

      If j is an 8 bit signed char this is a problem.
      [color=blue]
      > delay(2000);
      > }
      > }
      > }[/color]

      What strange character is that after the close brace?

      <snip>
      [color=blue]
      > C:/Documents and Settings/farm/TEST.C: At global scope:
      > C:/Documents and Settings/farm/TEST.C:33: stray '\32' in program[/color]

      Looks like that is the screwy character at the end of the file. Delete
      it.
      [color=blue]
      > C:/Documents and Settings/farm/TEST.C:33:3: warning: no newline at end
      > C:of
      > file[/color]

      The last line of the file needs a newline, so press return at the end of
      it then save after dealing with the above.
      [color=blue]
      > Execution terminated[/color]

      If this is your code I suggest throwing it away and reading up on the
      extensions your implementation provides that might let you do what you
      want. If this is someone elses code that you have to recompile and use
      then you will have to find out what system they used and use that since
      the important bits of it are completely non-standard.

      Either way there is very little we can help you with here, you need
      implementation specific help and we deal with standard C.
      --
      Flash Gordon
      Living in interesting times.
      Although my email address says spam, it is real and I read it.

      Comment

      • James McIninch

        #4
        Re: re-compile error

        Simply rewrite the code in C, modifying the compiler-specific portions to
        accomodate the new compiler.

        developer wrote:
        [color=blue]
        > re-compile under dev -c++ bloodshed.
        >
        > can u help ?
        >
        >
        > #include<dos.h>
        > #include<proces s.h>
        > #include<io.h>
        > #include<stdio. h>
        > #define STROBE 0x01
        > #define NOT_STB 0x00
        >
        > void main()
        > {
        > char i,j;
        > unsigned int CTRL_PORT,STAR_ PORT;
        > unsigned int far *DATA_PORT;
        > DATA_PORT=MK_FP (0x0000,0x0408) ;
        > STAR_PORT=*DATA _PORT+1;
        > CTRL_PORT=STAR_ PORT+1;
        > outport(CTRL_PO RT,0x00);
        > while(1)
        > {
        > outport(*DATA_P ORT,0x00);
        > delay(2000);
        > outport(*DATA_P ORT,0xff);
        > delay(2000);
        > outport(*DATA_P ORT,0x00);
        > delay(2000);
        > j=0x80;
        > for(i=0;i<8;i++ )
        > {
        > outport(*DATA_P ORT,j);
        > j=j>>1;
        > delay(2000);
        > }
        > }
        > }
        >
        >
        > Compiler: Default compiler
        > Executing gcc.exe...
        > gcc.exe "C:\Documen ts and Settings\farm\T EST.C" -o "C:\Documen ts and
        > Settings\farm\T EST.exe" -g3 -I"C:\Dev-Cpp\include" -L"C:\Dev-Cpp\lib"
        > C:/Documents and Settings/farm/TEST.C:9: `main' must return `int'
        > C:/Documents and Settings/farm/TEST.C: In function `int main(...)':
        > C:/Documents and Settings/farm/TEST.C:12: parse error before `*'
        > token
        > C:/Documents and Settings/farm/TEST.C:13: `DATA_PORT' undeclared
        > (first use this function)
        > C:/Documents and Settings/farm/TEST.C:13: (Each undeclared
        > identifier is reported only once for each function it appears in.)
        > C:/Documents and Settings/farm/TEST.C:13: `MK_FP' undeclared (first
        > use this function)
        > C:/Documents and Settings/farm/TEST.C:16: `outport' undeclared
        > (first use this function)
        > C:/Documents and Settings/farm/TEST.C:20: `delay' undeclared (first
        > use this function)
        >
        > C:/Documents and Settings/farm/TEST.C: At global scope:
        > C:/Documents and Settings/farm/TEST.C:33: stray '\32' in program
        >
        > C:/Documents and Settings/farm/TEST.C:33:3: warning: no newline at end of
        > file
        >
        > Execution terminated[/color]

        --
        Remove '.nospam' from e-mail address to reply by e-mail

        Comment

        • jacob navia

          #5
          Re: re-compile error

          developer wrote:[color=blue]
          > re-compile under dev -c++ bloodshed.
          >
          > can u help ?
          >
          >
          > #include<dos.h>
          > #include<proces s.h>
          > #include<io.h>
          > #include<stdio. h>
          > #define STROBE 0x01
          > #define NOT_STB 0x00
          >
          > void main()
          > {
          > char i,j;
          > unsigned int CTRL_PORT,STAR_ PORT;
          > unsigned int far *DATA_PORT;
          > DATA_PORT=MK_FP (0x0000,0x0408) ;
          > STAR_PORT=*DATA _PORT+1;
          > CTRL_PORT=STAR_ PORT+1;
          > outport(CTRL_PO RT,0x00);
          > while(1)
          > {
          > outport(*DATA_P ORT,0x00);
          > delay(2000);
          > outport(*DATA_P ORT,0xff);
          > delay(2000);
          > outport(*DATA_P ORT,0x00);
          > delay(2000);
          > j=0x80;
          > for(i=0;i<8;i++ )
          > {
          > outport(*DATA_P ORT,j);
          > j=j>>1;
          > delay(2000);
          > }
          > }
          > }
          >
          >
          > Compiler: Default compiler
          > Executing gcc.exe...
          > gcc.exe "C:\Documen ts and Settings\farm\T EST.C" -o "C:\Documen ts and
          > Settings\farm\T EST.exe" -g3 -I"C:\Dev-Cpp\include" -L"C:\Dev-Cpp\lib"
          > C:/Documents and Settings/farm/TEST.C:9: `main' must return `int'
          > C:/Documents and Settings/farm/TEST.C: In function `int main(...)':
          > C:/Documents and Settings/farm/TEST.C:12: parse error before `*'
          > token
          > C:/Documents and Settings/farm/TEST.C:13: `DATA_PORT' undeclared
          > (first use this function)
          > C:/Documents and Settings/farm/TEST.C:13: (Each undeclared
          > identifier is reported only once for each function it appears in.)
          > C:/Documents and Settings/farm/TEST.C:13: `MK_FP' undeclared (first
          > use this function)
          > C:/Documents and Settings/farm/TEST.C:16: `outport' undeclared
          > (first use this function)
          > C:/Documents and Settings/farm/TEST.C:20: `delay' undeclared (first
          > use this function)
          >
          > C:/Documents and Settings/farm/TEST.C: At global scope:
          > C:/Documents and Settings/farm/TEST.C:33: stray '\32' in program
          >
          > C:/Documents and Settings/farm/TEST.C:33:3: warning: no newline at end of
          > file
          >
          > Execution terminated
          >
          >[/color]

          You are running under the windows OS. This OS is NOT the DOS
          operating system that was discontinued more than 10 years ago.

          This program is writing to a specific address. This will never work
          under the win32 versions of windows (windows 95 or higher).

          But all this is probably too technical for you. The fact that you
          attempt to compile this under windows shows that you haven't got
          any idea what this code is doing. I would suggest that you find
          someone competent and give this to him (her).

          Under DOS, you could write to any memory address since the OS
          wasn't using protected mode and virtual memory. This doesn't work
          since windows 95...

          Anyway, maybe it will run if you compile it under a 16 bit DOS compiler
          under the emulation layer of windows, who knows.

          jacob

          Comment

          • developer

            #6
            Re: re-compile error


            "jacob navia" <jacob@jacob.re mcomp.fr> дÈëÓʼþ
            news:41bd8a8f$0 $3106$8fcfb975@ news.wanadoo.fr ...[color=blue]
            > developer wrote:[color=green]
            > > re-compile under dev -c++ bloodshed.
            > >
            > > can u help ?
            > >
            > >
            > > #include<dos.h>
            > > #include<proces s.h>
            > > #include<io.h>
            > > #include<stdio. h>
            > > #define STROBE 0x01
            > > #define NOT_STB 0x00
            > >
            > > void main()
            > > {
            > > char i,j;
            > > unsigned int CTRL_PORT,STAR_ PORT;
            > > unsigned int far *DATA_PORT;
            > > DATA_PORT=MK_FP (0x0000,0x0408) ;
            > > STAR_PORT=*DATA _PORT+1;
            > > CTRL_PORT=STAR_ PORT+1;
            > > outport(CTRL_PO RT,0x00);
            > > while(1)
            > > {
            > > outport(*DATA_P ORT,0x00);
            > > delay(2000);
            > > outport(*DATA_P ORT,0xff);
            > > delay(2000);
            > > outport(*DATA_P ORT,0x00);
            > > delay(2000);
            > > j=0x80;
            > > for(i=0;i<8;i++ )
            > > {
            > > outport(*DATA_P ORT,j);
            > > j=j>>1;
            > > delay(2000);
            > > }
            > > }
            > > }
            > >
            > >
            > > Compiler: Default compiler
            > > Executing gcc.exe...
            > > gcc.exe "C:\Documen ts and Settings\farm\T EST.C" -o "C:\Documen ts and
            > >[/color][/color]
            ttings\farm\TES T.exe" -g3 -I"C:\Dev-Cpp\include" -L"C:\Dev-Cpp\lib"[color=blue][color=green]
            > > C:/Documents and Settings/farm/TEST.C:9: `main' must return `int'
            > > C:/Documents and Settings/farm/TEST.C: In function `int main(...)':
            > > C:/Documents and Settings/farm/TEST.C:12: parse error before `*'
            > > token
            > > C:/Documents and Settings/farm/TEST.C:13: `DATA_PORT' undeclared
            > > (first use this function)
            > > C:/Documents and Settings/farm/TEST.C:13: (Each undeclared
            > > identifier is reported only once for each function it appears in.)
            > > C:/Documents and Settings/farm/TEST.C:13: `MK_FP' undeclared (first
            > > use this function)
            > > C:/Documents and Settings/farm/TEST.C:16: `outport' undeclared
            > > (first use this function)
            > > C:/Documents and Settings/farm/TEST.C:20: `delay' undeclared (first
            > > use this function)
            > >
            > > C:/Documents and Settings/farm/TEST.C: At global scope:
            > > C:/Documents and Settings/farm/TEST.C:33: stray '\32' in program
            > >
            > > C:/Documents and Settings/farm/TEST.C:33:3: warning: no newline at end[/color][/color]
            of[color=blue][color=green]
            > > file
            > >
            > > Execution terminated
            > >
            > >[/color]
            >[/color]
            if I can find turbo for win xp ( 32 bit) and recompile the program, will
            that works?
            can a 16 bit turbo C works on 32 bit machine?

            or

            if I can find a dos 3.3, and a copy turbo C compile and compile the edited
            under dos 3.3?

            what other option, to make this hardware and source code C that I have at
            the moment, to make it work under XP environment.


            Comment

            • jacob navia

              #7
              Re: re-compile error

              developer wrote:[color=blue]
              > "jacob navia" <jacob@jacob.re mcomp.fr> дÈëÓʼþ
              > news:41bd8a8f$0 $3106$8fcfb975@ news.wanadoo.fr ...
              >[color=green]
              >>developer wrote:
              >>[color=darkred]
              >>>re-compile under dev -c++ bloodshed.
              >>>
              >>>can u help ?
              >>>
              >>>
              >>>#include<dos .h>
              >>>#include<pro cess.h>
              >>>#include<io. h>
              >>>#include<std io.h>
              >>>#define STROBE 0x01
              >>>#define NOT_STB 0x00
              >>>
              >>>void main()
              >>>{
              >>>char i,j;
              >>>unsigned int CTRL_PORT,STAR_ PORT;
              >>>unsigned int far *DATA_PORT;
              >>>DATA_PORT=MK _FP(0x0000,0x04 08);
              >>>STAR_PORT=*D ATA_PORT+1;
              >>>CTRL_PORT=ST AR_PORT+1;
              >>>outport(CTRL _PORT,0x00);
              >>>while(1)
              >>>{
              >>>outport(*DAT A_PORT,0x00);
              >>>delay(2000 );
              >>>outport(*DAT A_PORT,0xff);
              >>>delay(2000 );
              >>>outport(*DAT A_PORT,0x00);
              >>>delay(2000 );
              >>>j=0x80;
              >>>for(i=0;i<8; i++)
              >>>{
              >>>outport(*DAT A_PORT,j);
              >>>j=j>>1;
              >>>delay(2000 );
              >>>}
              >>>}
              >>>}
              >>>
              >>>
              >>>Compiler: Default compiler
              >>>Executing gcc.exe...
              >>>gcc.exe "C:\Documen ts and Settings\farm\T EST.C" -o "C:\Documen ts and
              >>>[/color][/color]
              >
              > ttings\farm\TES T.exe" -g3 -I"C:\Dev-Cpp\include" -L"C:\Dev-Cpp\lib"
              >[color=green][color=darkred]
              >>>C:/Documents and Settings/farm/TEST.C:9: `main' must return `int'
              >>>C:/Documents and Settings/farm/TEST.C: In function `int main(...)':
              >>>C:/Documents and Settings/farm/TEST.C:12: parse error before `*'
              >>> token
              >>>C:/Documents and Settings/farm/TEST.C:13: `DATA_PORT' undeclared
              >>> (first use this function)
              >>>C:/Documents and Settings/farm/TEST.C:13: (Each undeclared
              >>> identifier is reported only once for each function it appears in.)
              >>>C:/Documents and Settings/farm/TEST.C:13: `MK_FP' undeclared (first
              >>> use this function)
              >>>C:/Documents and Settings/farm/TEST.C:16: `outport' undeclared
              >>> (first use this function)
              >>>C:/Documents and Settings/farm/TEST.C:20: `delay' undeclared (first
              >>> use this function)
              >>>
              >>>C:/Documents and Settings/farm/TEST.C: At global scope:
              >>>C:/Documents and Settings/farm/TEST.C:33: stray '\32' in program
              >>>
              >>>C:/Documents and Settings/farm/TEST.C:33:3: warning: no newline at end[/color][/color]
              >
              > of
              >[color=green][color=darkred]
              >>>file
              >>>
              >>>Execution terminated
              >>>
              >>>[/color]
              >>[/color]
              > if I can find turbo for win xp ( 32 bit) and recompile the program, will
              > that works?[/color]

              no, the 32 bit compiler will not work

              [color=blue]
              > can a 16 bit turbo C works on 32 bit machine?
              >[/color]

              under the emulation layer yes
              [color=blue]
              > or
              >
              > if I can find a dos 3.3, and a copy turbo C compile and compile the edited
              > under dos 3.3?
              >[/color]

              yes. Get an old pC, install DOS, install turbo c 16 bits for DOS
              recompile
              [color=blue]
              > what other option, to make this hardware and source code C that I have at
              > the moment, to make it work under XP environment.
              >[/color]

              Maybe it will work under the emulation layer, maybe not.

              You will have to tweak the DOS emulation layer settings in the
              properties of the shortcut to the program

              Comment

              • Jens.Toerring@physik.fu-berlin.de

                #8
                Re: re-compile error

                developer <noemail@sina.c om> wrote:
                <lots of irrelevant stuff snipped>

                Please remove things not relevant to your postings.
                [color=blue]
                > if I can find turbo for win xp ( 32 bit) and recompile the program, will
                > that works?
                > can a 16 bit turbo C works on 32 bit machine?
                > or
                > if I can find a dos 3.3, and a copy turbo C compile and compile the edited
                > under dos 3.3?
                > what other option, to make this hardware and source code C that I have at
                > the moment, to make it work under XP environment.[/color]

                Ask these questions in a appropriate newsgroup. All this has nothing
                to do with the programming language C and several people already told
                you to go to a MS related newsgroup because that's where it might be
                on-topic and where you will find the experts for that kind of prolems.

                Regards, Jens
                --
                \ Jens Thoms Toerring ___ Jens.Toerring@p hysik.fu-berlin.de
                \______________ ____________ http://www.toerring.de

                Comment

                • Flash Gordon

                  #9
                  Re: re-compile error

                  On Mon, 13 Dec 2004 15:41:24 +0100
                  jacob navia <jacob@jacob.re mcomp.fr> wrote:
                  [color=blue]
                  > developer wrote:[/color]

                  <snip DOS/Windows specific rubish.
                  [color=blue][color=green]
                  > > what other option, to make this hardware and source code C that I
                  > > have at the moment, to make it work under XP environment.
                  > >[/color]
                  >
                  > Maybe it will work under the emulation layer, maybe not.
                  >
                  > You will have to tweak the DOS emulation layer settings in the
                  > properties of the shortcut to the program[/color]

                  You will also have to take it to either a DOS/Windows news group or to
                  email. This is COMPLETELY OFF TOPIC.
                  --
                  Flash Gordon
                  Living in interesting times.
                  Although my email address says spam, it is real and I read it.

                  Comment

                  • Martin Ambuhl

                    #10
                    Re: re-compile error

                    developer wrote:[color=blue]
                    > re-compile under dev -c++ bloodshed.[/color]
                    [...]
                    Please post implementation-specific questions to implementation-specific
                    newsgroups or mailing lists.

                    <off-topic>
                    I have no idea if this works (since the functions outportb and delay are
                    not part of C). The attempt to set DATA_PORT to a specific place in
                    memory is likely to fail; use your implementation-supplied mechanism for
                    that. Even in non-standard code like this, it would be a good idea to
                    stop flouting normal conventions with your use of all caps for things
                    that are not macros.

                    #include <pc.h> /* non-standard header */
                    #include <dos.h> /* non-standard header */

                    int main()
                    {
                    unsigned char i, j;
                    unsigned int CTRL_PORT, STAR_PORT;
                    unsigned int *DATA_PORT = (unsigned int *) 0x0408;
                    STAR_PORT = *DATA_PORT + 1;
                    CTRL_PORT = STAR_PORT + 1;
                    outportb(CTRL_P ORT, 0x00);
                    while (1) {
                    outportb(*DATA_ PORT, 0x00);
                    delay(2000);
                    outportb(*DATA_ PORT, 0xff);
                    delay(2000);
                    outportb(*DATA_ PORT, 0x00);
                    delay(2000);
                    j = 0x80;
                    for (i = 0; i < 8; i++) {
                    outportb(*DATA_ PORT, j);
                    j = j >> 1;
                    delay(2000);
                    }
                    }
                    return 0;
                    }

                    </offtopic>

                    Comment

                    • Keith Thompson

                      #11
                      Re: re-compile error

                      Jens.Toerring@p hysik.fu-berlin.de writes:
                      [...][color=blue]
                      > The last character in a regular C program must be a line feed. The ^Z
                      > stuff is an abomination from very old DOS programs where it was meant
                      > to indicate the end of the file. Normal compilers will choke on it.[/color]

                      A C source file must end in an end-of-line indicator, which is
                      translated to a new-line character in translation phase 1. This
                      needn't be a line feed character.

                      It's also possible that phase 1 will eliminate the ^Z character.
                      I have no idea whether the OP's compiler actually does this.

                      --
                      Keith Thompson (The_Other_Keit h) kst-u@mib.org <http://www.ghoti.net/~kst>
                      San Diego Supercomputer Center <*> <http://users.sdsc.edu/~kst>
                      We must do something. This is something. Therefore, we must do this.

                      Comment

                      • Keith Thompson

                        #12
                        Re: re-compile error

                        Keith Thompson <kst-u@mib.org> writes:[color=blue]
                        > Jens.Toerring@p hysik.fu-berlin.de writes:
                        > [...][color=green]
                        >> The last character in a regular C program must be a line feed. The ^Z
                        >> stuff is an abomination from very old DOS programs where it was meant
                        >> to indicate the end of the file. Normal compilers will choke on it.[/color]
                        >
                        > A C source file must end in an end-of-line indicator, which is
                        > translated to a new-line character in translation phase 1. This
                        > needn't be a line feed character.
                        >
                        > It's also possible that phase 1 will eliminate the ^Z character.
                        > I have no idea whether the OP's compiler actually does this.[/color]

                        Actually, since the OP's compiler complained about it:

                        C:/Documents and Settings/farm/TEST.C:33: stray '\32' in program

                        apparently it doesn't eliminate the ^Z character. ('\32' is ASCII
                        character 26, also known as ^Z.) Presumably the compiler for which
                        the source file was intended behaved differently.

                        --
                        Keith Thompson (The_Other_Keit h) kst-u@mib.org <http://www.ghoti.net/~kst>
                        San Diego Supercomputer Center <*> <http://users.sdsc.edu/~kst>
                        We must do something. This is something. Therefore, we must do this.

                        Comment

                        • Jack Klein

                          #13
                          Re: re-compile error

                          On Mon, 13 Dec 2004 13:26:57 +0100, jacob navia
                          <jacob@jacob.re mcomp.fr> wrote in comp.lang.c:
                          [color=blue]
                          > You are running under the windows OS. This OS is NOT the DOS
                          > operating system that was discontinued more than 10 years ago.[/color]

                          If I've told you once, I've told you LLONG_MAX times not to
                          exaggerate.

                          <OT>
                          MS-DOS 7.1, on which this program would work with the appropriate
                          compiler, headers, and libraries, was shipping as part of Windows 98
                          well into the year 2000 when Windows 98 was replaced by Windows
                          Millennium. Hardly "more than 10 years ago". Not even 5, in fact.
                          </OT>

                          --
                          Jack Klein
                          Home: http://JK-Technology.Com
                          FAQs for
                          comp.lang.c http://www.eskimo.com/~scs/C-faq/top.html
                          comp.lang.c++ http://www.parashift.com/c++-faq-lite/
                          alt.comp.lang.l earn.c-c++

                          Comment

                          • jacob navia

                            #14
                            Re: re-compile error

                            Jack Klein wrote:[color=blue]
                            > On Mon, 13 Dec 2004 13:26:57 +0100, jacob navia
                            > <jacob@jacob.re mcomp.fr> wrote in comp.lang.c:
                            >
                            >[color=green]
                            >>You are running under the windows OS. This OS is NOT the DOS
                            >>operating system that was discontinued more than 10 years ago.[/color]
                            >
                            >
                            > If I've told you once, I've told you LLONG_MAX times not to
                            > exaggerate.
                            >
                            > <OT>
                            > MS-DOS 7.1, on which this program would work with the appropriate
                            > compiler, headers, and libraries, was shipping as part of Windows 98
                            > well into the year 2000 when Windows 98 was replaced by Windows
                            > Millennium. Hardly "more than 10 years ago". Not even 5, in fact.
                            > </OT>
                            >[/color]

                            An emulation layer is available still TODAY.

                            Those are *emulations* of msdos under a virtual 16 bit machine running
                            under the windows OS. NOT native compiled applications.

                            I spoke about that emulation layer in my message.

                            Comment

                            Working...