Rocksolid Light

Welcome to novaBBS (click a section below)

mail  files  register  newsreader  groups  login

Message-ID:  

A transistor protected by a fast-acting fuse will protect the fuse by blowing first.


devel / comp.lang.c / Re: Trouble compiling 8080 emulator written in C

SubjectAuthor
* Trouble compiling 8080 emulator written in CWilliam Gallant
+* Re: Trouble compiling 8080 emulator written in CLew Pitcher
|`* Re: Trouble compiling 8080 emulator written in CWilliam Gallant
| +- Re: Trouble compiling 8080 emulator written in CKeith Thompson
| +- Re: Trouble compiling 8080 emulator written in CKeith Thompson
| `* Re: Trouble compiling 8080 emulator written in CDavid Brown
|  `- Re: Trouble compiling 8080 emulator written in Cminf...@arcor.de
+* Re: Trouble compiling 8080 emulator written in CBart
|+- Re: Trouble compiling 8080 emulator written in CWilliam Gallant
|+- Re: Trouble compiling 8080 emulator written in CKeith Thompson
|`* Re: Trouble compiling 8080 emulator written in CBen Bacarisse
| `* Re: Trouble compiling 8080 emulator written in CWilliam Gallant
|  +- Re: Trouble compiling 8080 emulator written in CBen Bacarisse
|  `* Re: Trouble compiling 8080 emulator written in CBart
|   +* Re: Trouble compiling 8080 emulator written in CWilliam Gallant
|   |`- Re: Trouble compiling 8080 emulator written in CKeith Thompson
|   `* Re: Trouble compiling 8080 emulator written in CKeith Thompson
|    `* Re: Trouble compiling 8080 emulator written in CBart
|     +- Re: Trouble compiling 8080 emulator written in CKeith Thompson
|     `- Re: Trouble compiling 8080 emulator written in CDick
+* Re: Trouble compiling 8080 emulator written in CGuillaume
|`* Re: Trouble compiling 8080 emulator written in CWilliam Gallant
| `- Re: Trouble compiling 8080 emulator written in CBart
`* Re: Trouble compiling 8080 emulator written in CKaz Kylheku
 `- Re: Trouble compiling 8080 emulator written in CScott Lurndal

1
Trouble compiling 8080 emulator written in C

<184050e8-3d32-4fb7-a37f-89388fc7e893n@googlegroups.com>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=19585&group=comp.lang.c#19585

  copy link   Newsgroups: comp.lang.c
X-Received: by 2002:a05:622a:3cb:: with SMTP id k11mr146986qtx.381.1640039775081;
Mon, 20 Dec 2021 14:36:15 -0800 (PST)
X-Received: by 2002:a05:622a:11ce:: with SMTP id n14mr172845qtk.432.1640039774886;
Mon, 20 Dec 2021 14:36:14 -0800 (PST)
Path: i2pn2.org!i2pn.org!weretis.net!feeder6.news.weretis.net!news.misty.com!border2.nntp.dca1.giganews.com!nntp.giganews.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.c
Date: Mon, 20 Dec 2021 14:36:14 -0800 (PST)
Injection-Info: google-groups.googlegroups.com; posting-host=65.183.150.237; posting-account=vzxIggoAAAC53erQVj401_8QIq-X6kHc
NNTP-Posting-Host: 65.183.150.237
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <184050e8-3d32-4fb7-a37f-89388fc7e893n@googlegroups.com>
Subject: Trouble compiling 8080 emulator written in C
From: sigma.re...@gmail.com (William Gallant)
Injection-Date: Mon, 20 Dec 2021 22:36:15 +0000
Content-Type: text/plain; charset="UTF-8"
Lines: 7
 by: William Gallant - Mon, 20 Dec 2021 22:36 UTC

I don't know "C" well, and have tried Tiny C and the old Turbo C 2.01 to get the file 8080.c compiled to work with MS-DOS, and was wondering if someone here can compile it for me ( also explain the steps ).

8080.c located here at MSN OneDrive
https://1drv.ms/u/s!Ak_7nwQxFkS7iHfKQT0cp9uDLt1I

Thanks and
Merry Christmas
-- William Gallant

Re: Trouble compiling 8080 emulator written in C

<spr13u$9dt$1@dont-email.me>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=19586&group=comp.lang.c#19586

  copy link   Newsgroups: comp.lang.c
Path: i2pn2.org!i2pn.org!eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mail
From: lew.pitc...@digitalfreehold.ca (Lew Pitcher)
Newsgroups: comp.lang.c
Subject: Re: Trouble compiling 8080 emulator written in C
Date: Mon, 20 Dec 2021 22:46:22 -0000 (UTC)
Organization: A noiseless patient Spider
Lines: 15
Message-ID: <spr13u$9dt$1@dont-email.me>
References: <184050e8-3d32-4fb7-a37f-89388fc7e893n@googlegroups.com>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Injection-Date: Mon, 20 Dec 2021 22:46:22 -0000 (UTC)
Injection-Info: reader02.eternal-september.org; posting-host="d7318b4b8c934fcc54aa7ac78f8389fc";
logging-data="9661"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX193mDqrfQlWLRQwguN5Df6myQTkQp6Ut9I="
User-Agent: Pan/0.139 (Sexual Chocolate; GIT bf56508
git://git.gnome.org/pan2)
Cancel-Lock: sha1:nnlYh4RBpRO12mcM3XYbiLpW7rs=
 by: Lew Pitcher - Mon, 20 Dec 2021 22:46 UTC

On Mon, 20 Dec 2021 14:36:14 -0800, William Gallant wrote:

> I don't know "C" well, and have tried Tiny C and the old Turbo C 2.01 to
> get the file 8080.c compiled to work with MS-DOS, and was wondering if
> someone here can compile it for me ( also explain the steps ).

Funny, it compiles and links well enough with gcc (GCC) 5.5.0 under 64bit
Slackware Linux 14.2 (kernel 4.4.276). There's a ton of warnings relating
to the compiler's modern response to K&R style code, but the source code
compiles OK.

What sort of problems are you having compiling this code?
--
Lew Pitcher
"In Skills, We Trust"

Re: Trouble compiling 8080 emulator written in C

<745ca925-f599-4c61-b59a-f253c333e20fn@googlegroups.com>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=19587&group=comp.lang.c#19587

  copy link   Newsgroups: comp.lang.c
X-Received: by 2002:ac8:7e8d:: with SMTP id w13mr251237qtj.527.1640041962434;
Mon, 20 Dec 2021 15:12:42 -0800 (PST)
X-Received: by 2002:a05:620a:94c:: with SMTP id w12mr383570qkw.190.1640041962210;
Mon, 20 Dec 2021 15:12:42 -0800 (PST)
Path: i2pn2.org!i2pn.org!weretis.net!feeder6.news.weretis.net!news.misty.com!border2.nntp.dca1.giganews.com!nntp.giganews.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.c
Date: Mon, 20 Dec 2021 15:12:41 -0800 (PST)
In-Reply-To: <spr13u$9dt$1@dont-email.me>
Injection-Info: google-groups.googlegroups.com; posting-host=65.183.150.237; posting-account=vzxIggoAAAC53erQVj401_8QIq-X6kHc
NNTP-Posting-Host: 65.183.150.237
References: <184050e8-3d32-4fb7-a37f-89388fc7e893n@googlegroups.com> <spr13u$9dt$1@dont-email.me>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <745ca925-f599-4c61-b59a-f253c333e20fn@googlegroups.com>
Subject: Re: Trouble compiling 8080 emulator written in C
From: sigma.re...@gmail.com (William Gallant)
Injection-Date: Mon, 20 Dec 2021 23:12:42 +0000
Content-Type: text/plain; charset="UTF-8"
Lines: 23
 by: William Gallant - Mon, 20 Dec 2021 23:12 UTC

On Monday, December 20, 2021 at 5:46:35 PM UTC-5, Lew Pitcher wrote:
> On Mon, 20 Dec 2021 14:36:14 -0800, William Gallant wrote:
>
> > I don't know "C" well, and have tried Tiny C and the old Turbo C 2.01 to
> > get the file 8080.c compiled to work with MS-DOS, and was wondering if
> > someone here can compile it for me ( also explain the steps ).
> Funny, it compiles and links well enough with gcc (GCC) 5.5.0 under 64bit
> Slackware Linux 14.2 (kernel 4.4.276). There's a ton of warnings relating
> to the compiler's modern response to K&R style code, but the source code
> compiles OK.
>
> What sort of problems are you having compiling this code?
> --
> Lew Pitcher
> "In Skills, We Trust"

The only error is
line 135 - cannot cast int() ro void *(int)

when i use tcc ( tiny c compiler ) on Windows 11 under PowerShell.
I don't have a linux machine. If i were to use gcc i could use mingw
but i don't have that and would rather somehow have an executable
i can run under DOSBox.
How to compile under DOSBox or powershell?

Re: Trouble compiling 8080 emulator written in C

<87pmpq6c3x.fsf@nosuchdomain.example.com>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=19588&group=comp.lang.c#19588

  copy link   Newsgroups: comp.lang.c
Path: i2pn2.org!i2pn.org!eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mail
From: Keith.S....@gmail.com (Keith Thompson)
Newsgroups: comp.lang.c
Subject: Re: Trouble compiling 8080 emulator written in C
Date: Mon, 20 Dec 2021 16:22:10 -0800
Organization: None to speak of
Lines: 30
Message-ID: <87pmpq6c3x.fsf@nosuchdomain.example.com>
References: <184050e8-3d32-4fb7-a37f-89388fc7e893n@googlegroups.com>
<spr13u$9dt$1@dont-email.me>
<745ca925-f599-4c61-b59a-f253c333e20fn@googlegroups.com>
Mime-Version: 1.0
Content-Type: text/plain
Injection-Info: reader02.eternal-september.org; posting-host="f0137104e22f610b6b35515f566641fb";
logging-data="25744"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19nPV5FnFqo4aKeuolu5Wyh"
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.2 (gnu/linux)
Cancel-Lock: sha1:iPXjRBRl95khPezTl/EmtPy2euc=
sha1:eiZjLBXgVYGxWvFY239IkcS7jwc=
 by: Keith Thompson - Tue, 21 Dec 2021 00:22 UTC

William Gallant <sigma.research@gmail.com> writes:
> On Monday, December 20, 2021 at 5:46:35 PM UTC-5, Lew Pitcher wrote:
>> On Mon, 20 Dec 2021 14:36:14 -0800, William Gallant wrote:
>>
>> > I don't know "C" well, and have tried Tiny C and the old Turbo C 2.01 to
>> > get the file 8080.c compiled to work with MS-DOS, and was wondering if
>> > someone here can compile it for me ( also explain the steps ).
>> Funny, it compiles and links well enough with gcc (GCC) 5.5.0 under 64bit
>> Slackware Linux 14.2 (kernel 4.4.276). There's a ton of warnings relating
>> to the compiler's modern response to K&R style code, but the source code
>> compiles OK.
>>
>> What sort of problems are you having compiling this code?
>
> The only error is
> line 135 - cannot cast int() ro void *(int)
>
> when i use tcc ( tiny c compiler ) on Windows 11 under PowerShell.
> I don't have a linux machine. If i were to use gcc i could use mingw
> but i don't have that and would rather somehow have an executable
> i can run under DOSBox.
> How to compile under DOSBox or powershell?

Can you show us the *exact* (copy-and-pasted) error message? There's at
least one typo in what you showed us. Other descrepancies might be critical.

--
Keith Thompson (The_Other_Keith) Keith.S.Thompson+u@gmail.com
Working, but not speaking, for Philips
void Void(void) { Void(); } /* The recursive call of the void */

Re: Trouble compiling 8080 emulator written in C

<87lf0e6bgy.fsf@nosuchdomain.example.com>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=19589&group=comp.lang.c#19589

  copy link   Newsgroups: comp.lang.c
Path: i2pn2.org!i2pn.org!eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mail
From: Keith.S....@gmail.com (Keith Thompson)
Newsgroups: comp.lang.c
Subject: Re: Trouble compiling 8080 emulator written in C
Date: Mon, 20 Dec 2021 16:35:57 -0800
Organization: None to speak of
Lines: 46
Message-ID: <87lf0e6bgy.fsf@nosuchdomain.example.com>
References: <184050e8-3d32-4fb7-a37f-89388fc7e893n@googlegroups.com>
<spr13u$9dt$1@dont-email.me>
<745ca925-f599-4c61-b59a-f253c333e20fn@googlegroups.com>
Mime-Version: 1.0
Content-Type: text/plain
Injection-Info: reader02.eternal-september.org; posting-host="f0137104e22f610b6b35515f566641fb";
logging-data="25744"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18l1p2Kga+0AUyg8u40T74p"
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.2 (gnu/linux)
Cancel-Lock: sha1:S353TgXg8BEU55ufpteYW0O0CqU=
sha1:muX0BDcBZqAXRXmFeFZx0sij5IU=
 by: Keith Thompson - Tue, 21 Dec 2021 00:35 UTC

William Gallant <sigma.research@gmail.com> writes:
> On Monday, December 20, 2021 at 5:46:35 PM UTC-5, Lew Pitcher wrote:
>> On Mon, 20 Dec 2021 14:36:14 -0800, William Gallant wrote:
>>
>> > I don't know "C" well, and have tried Tiny C and the old Turbo C 2.01 to
>> > get the file 8080.c compiled to work with MS-DOS, and was wondering if
>> > someone here can compile it for me ( also explain the steps ).
>> Funny, it compiles and links well enough with gcc (GCC) 5.5.0 under 64bit
>> Slackware Linux 14.2 (kernel 4.4.276). There's a ton of warnings relating
>> to the compiler's modern response to K&R style code, but the source code
>> compiles OK.
>>
>> What sort of problems are you having compiling this code?
>
> The only error is
> line 135 - cannot cast int() ro void *(int)
>
> when i use tcc ( tiny c compiler ) on Windows 11 under PowerShell.
> I don't have a linux machine. If i were to use gcc i could use mingw
> but i don't have that and would rather somehow have an executable
> i can run under DOSBox.
> How to compile under DOSBox or powershell?

Line 135 is:

signal(SIGTERM, exit);

Since the code doesn't #include <stdlib.h>, the compiler (following old
rules) makes assumptions about how the exit function is declared.

The code has a lot of constructs that are syntax errors or constraint
violations in modern C (1999 or later). Most of them trigger non-fatal
warnings in gcc, which is designed to tolerate old-style code by
default, but some compilers might be more picky. There's no particular
reason to expect that tcc won't treat something as a fatal error if gcc
lets it go with a non-fatal warning.

If I wanted to build and use this, I'd start by adding any required
#include directives (particularly for <stdlib.h>), specifying return
types for all functions, and converting old-style function definitions
to use prototypes.

--
Keith Thompson (The_Other_Keith) Keith.S.Thompson+u@gmail.com
Working, but not speaking, for Philips
void Void(void) { Void(); } /* The recursive call of the void */

Re: Trouble compiling 8080 emulator written in C

<spr8gj$62i$1@dont-email.me>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=19590&group=comp.lang.c#19590

  copy link   Newsgroups: comp.lang.c
Path: i2pn2.org!i2pn.org!eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mail
From: bc...@freeuk.com (Bart)
Newsgroups: comp.lang.c
Subject: Re: Trouble compiling 8080 emulator written in C
Date: Tue, 21 Dec 2021 00:52:35 +0000
Organization: A noiseless patient Spider
Lines: 35
Message-ID: <spr8gj$62i$1@dont-email.me>
References: <184050e8-3d32-4fb7-a37f-89388fc7e893n@googlegroups.com>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Tue, 21 Dec 2021 00:52:35 -0000 (UTC)
Injection-Info: reader02.eternal-september.org; posting-host="7769fdff9b1bf774db912ea3e7184bbe";
logging-data="6226"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1894lKTRaKJLBLD36tIeMMXYxHEeyg/EcE="
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101
Thunderbird/91.4.0
Cancel-Lock: sha1:h2vRjCGklP2HHb0PijkRKmJuoeg=
In-Reply-To: <184050e8-3d32-4fb7-a37f-89388fc7e893n@googlegroups.com>
 by: Bart - Tue, 21 Dec 2021 00:52 UTC

On 20/12/2021 22:36, William Gallant wrote:
> I don't know "C" well, and have tried Tiny C and the old Turbo C 2.01 to get the file 8080.c compiled to work with MS-DOS, and was wondering if someone here can compile it for me ( also explain the steps ).
>
> 8080.c located here at MSN OneDrive
> https://1drv.ms/u/s!Ak_7nwQxFkS7iHfKQT0cp9uDLt1I

This is appalling code. Clearly people weren't fans of declarations when
it was written, and didn't care whether functions returned values or not.

I've done some fixes so that it compiles with gcc and tiny c:

https://github.com/sal55/langs/blob/master/8080b.c

But there are some either some includes missing, or declarations:

getopt

I've added an assumed declaration for getopt(). (Also for gets(),
because one of the three compilers I tested didn't know it; you can
comment that out.)

There is also SIGTERM etc from line 144; I just commented these out.

With SIGTERM etc commented out:

Tcc compiles it but getopt, opterr, optarg are undefined when linking.

Somehow, gcc manages to compile and link it. When I run it, it says:

8080: program halted at 0000

I suspect that it assume that 'long' is wide enough for a pointer; I
suggest compiling with -m32 just in case.

Re: Trouble compiling 8080 emulator written in C

<65dd798f-992f-4108-9e10-1cd40bf96c5dn@googlegroups.com>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=19592&group=comp.lang.c#19592

  copy link   Newsgroups: comp.lang.c
X-Received: by 2002:ac8:7252:: with SMTP id l18mr558541qtp.9.1640048453522;
Mon, 20 Dec 2021 17:00:53 -0800 (PST)
X-Received: by 2002:ac8:5b90:: with SMTP id a16mr562328qta.300.1640048453367;
Mon, 20 Dec 2021 17:00:53 -0800 (PST)
Path: i2pn2.org!i2pn.org!weretis.net!feeder6.news.weretis.net!news.misty.com!border2.nntp.dca1.giganews.com!nntp.giganews.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.c
Date: Mon, 20 Dec 2021 17:00:53 -0800 (PST)
In-Reply-To: <spr8gj$62i$1@dont-email.me>
Injection-Info: google-groups.googlegroups.com; posting-host=65.183.150.237; posting-account=vzxIggoAAAC53erQVj401_8QIq-X6kHc
NNTP-Posting-Host: 65.183.150.237
References: <184050e8-3d32-4fb7-a37f-89388fc7e893n@googlegroups.com> <spr8gj$62i$1@dont-email.me>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <65dd798f-992f-4108-9e10-1cd40bf96c5dn@googlegroups.com>
Subject: Re: Trouble compiling 8080 emulator written in C
From: sigma.re...@gmail.com (William Gallant)
Injection-Date: Tue, 21 Dec 2021 01:00:53 +0000
Content-Type: text/plain; charset="UTF-8"
Lines: 7
 by: William Gallant - Tue, 21 Dec 2021 01:00 UTC

For the exact cut and paste error after
trying compilation with tcc under Windows 11 ---

8080.c:135: cannot cast 'int()' to 'void *(int)'

A few years ago i also tried to experiment with "blotting out"
the calls to signal() SIGTERM, SIGQUIT, SIGHUP, SIGINT
and substituting some makeshifts but i gave up.

Re: Trouble compiling 8080 emulator written in C

<87h7b269it.fsf@nosuchdomain.example.com>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=19593&group=comp.lang.c#19593

  copy link   Newsgroups: comp.lang.c
Path: i2pn2.org!i2pn.org!eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mail
From: Keith.S....@gmail.com (Keith Thompson)
Newsgroups: comp.lang.c
Subject: Re: Trouble compiling 8080 emulator written in C
Date: Mon, 20 Dec 2021 17:18:02 -0800
Organization: None to speak of
Lines: 59
Message-ID: <87h7b269it.fsf@nosuchdomain.example.com>
References: <184050e8-3d32-4fb7-a37f-89388fc7e893n@googlegroups.com>
<spr8gj$62i$1@dont-email.me>
Mime-Version: 1.0
Content-Type: text/plain
Injection-Info: reader02.eternal-september.org; posting-host="f0137104e22f610b6b35515f566641fb";
logging-data="25744"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX183P2R2KKk1cJ5trXbm79Kj"
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.2 (gnu/linux)
Cancel-Lock: sha1:/OLrJ/6Ft5g3ujutK8tB1mvr0Ww=
sha1:M65/Pp9z5Vodjm/dacY6oCrPfLQ=
 by: Keith Thompson - Tue, 21 Dec 2021 01:18 UTC

Bart <bc@freeuk.com> writes:
> On 20/12/2021 22:36, William Gallant wrote:
>> I don't know "C" well, and have tried Tiny C and the old Turbo C 2.01
>> to get the file 8080.c compiled to work with MS-DOS, and was
>> wondering if someone here can compile it for me ( also explain the
>> steps ).
>> 8080.c located here at MSN OneDrive
>> https://1drv.ms/u/s!Ak_7nwQxFkS7iHfKQT0cp9uDLt1I
>
> This is appalling code. Clearly people weren't fans of declarations
> when it was written, and didn't care whether functions returned values
> or not.

The code was written in 1990, when ANSI C compilers were not widely
available. The author couldn't assume that either the void type or
function prototypes were available. Given those limitations, it's not
too bad.

> I've done some fixes so that it compiles with gcc and tiny c:
>
> https://github.com/sal55/langs/blob/master/8080b.c
>
> But there are some either some includes missing, or declarations:
>
> getopt

getopt is declared in <unistd.h>, and is specified by POSIX.
The code apparently isn't intended for non-POSIX systems (or, when it
was written, non-Unix-like systems).

> I've added an assumed declaration for getopt(). (Also for gets(),
> because one of the three compilers I tested didn't know it; you can
> comment that out.)

Just replace the gets() call with a call to fgets(). It only looks at
the first charater entered, so the differing treament of newline
characters doesn't matter. Even before it was removed from the
language, gets() was dangerous.

> There is also SIGTERM etc from line 144; I just commented these out.

SIGTERM is defined in <signal.h>, and is specified by the C standard.
Does your implementation not have it?

> With SIGTERM etc commented out:
>
> Tcc compiles it but getopt, opterr, optarg are undefined when linking.
>
> Somehow, gcc manages to compile and link it. When I run it, it says:
>
> 8080: program halted at 0000
>
> I suspect that it assume that 'long' is wide enough for a pointer; I
> suggest compiling with -m32 just in case.

--
Keith Thompson (The_Other_Keith) Keith.S.Thompson+u@gmail.com
Working, but not speaking, for Philips
void Void(void) { Void(); } /* The recursive call of the void */

Re: Trouble compiling 8080 emulator written in C

<87lf0elp6i.fsf@bsb.me.uk>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=19594&group=comp.lang.c#19594

  copy link   Newsgroups: comp.lang.c
Path: i2pn2.org!i2pn.org!eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mail
From: ben.use...@bsb.me.uk (Ben Bacarisse)
Newsgroups: comp.lang.c
Subject: Re: Trouble compiling 8080 emulator written in C
Date: Tue, 21 Dec 2021 01:30:45 +0000
Organization: A noiseless patient Spider
Lines: 34
Message-ID: <87lf0elp6i.fsf@bsb.me.uk>
References: <184050e8-3d32-4fb7-a37f-89388fc7e893n@googlegroups.com>
<spr8gj$62i$1@dont-email.me>
Mime-Version: 1.0
Content-Type: text/plain
Injection-Info: reader02.eternal-september.org; posting-host="4b4f344d011d941e5ff3f27361205768";
logging-data="17848"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+9YTMpdgOmNtNy3X2/qXCEzvXAaya8mF4="
Cancel-Lock: sha1:MlrAQxxsYDABheCGtGNSihvMN+I=
sha1:lz8SEwp7MDcYqxMWw1MrrBx/rCI=
X-BSB-Auth: 1.b501d5ab345f563c5658.20211221013045GMT.87lf0elp6i.fsf@bsb.me.uk
 by: Ben Bacarisse - Tue, 21 Dec 2021 01:30 UTC

Bart <bc@freeuk.com> writes:

> On 20/12/2021 22:36, William Gallant wrote:
>> I don't know "C" well, and have tried Tiny C and the old Turbo C 2.01
>> to get the file 8080.c compiled to work with MS-DOS, and was
>> wondering if someone here can compile it for me ( also explain the
>> steps ).
>> 8080.c located here at MSN OneDrive
>> https://1drv.ms/u/s!Ak_7nwQxFkS7iHfKQT0cp9uDLt1I
>
> This is appalling code. Clearly people weren't fans of declarations
> when it was written, and didn't care whether functions returned values
> or not.

This is C as it was -- K&R C. There was no void. No function
prototypes. No return type (in fact any declaration with not type)
defaulted to int.

It's not the oldest K&R C -- there are unsigned types, typdefs and
compound assignments which are the modern way round (+= rather than
=+) -- but without a bang up to date compiler, this is what you used.

Mind you, ANSI C (later ISO C90), kept a lot of that for backwards
comparability, so one could say it is written in "old" C90.

> I've done some fixes so that it compiles with gcc and tiny c:
>
> https://github.com/sal55/langs/blob/master/8080b.c

It compiles with no changes on my Linx laptop. But I suspect there is
trouble ahead...

--
Ben.

Re: Trouble compiling 8080 emulator written in C

<783824d3-d70e-44ed-a250-fdb42c4b22f3n@googlegroups.com>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=19596&group=comp.lang.c#19596

  copy link   Newsgroups: comp.lang.c
X-Received: by 2002:ac8:5b01:: with SMTP id m1mr658870qtw.313.1640051798609;
Mon, 20 Dec 2021 17:56:38 -0800 (PST)
X-Received: by 2002:ad4:5d65:: with SMTP id fn5mr603262qvb.10.1640051798358;
Mon, 20 Dec 2021 17:56:38 -0800 (PST)
Path: i2pn2.org!i2pn.org!weretis.net!feeder6.news.weretis.net!news.misty.com!border2.nntp.dca1.giganews.com!nntp.giganews.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.c
Date: Mon, 20 Dec 2021 17:56:38 -0800 (PST)
In-Reply-To: <87lf0elp6i.fsf@bsb.me.uk>
Injection-Info: google-groups.googlegroups.com; posting-host=65.183.150.237; posting-account=vzxIggoAAAC53erQVj401_8QIq-X6kHc
NNTP-Posting-Host: 65.183.150.237
References: <184050e8-3d32-4fb7-a37f-89388fc7e893n@googlegroups.com>
<spr8gj$62i$1@dont-email.me> <87lf0elp6i.fsf@bsb.me.uk>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <783824d3-d70e-44ed-a250-fdb42c4b22f3n@googlegroups.com>
Subject: Re: Trouble compiling 8080 emulator written in C
From: sigma.re...@gmail.com (William Gallant)
Injection-Date: Tue, 21 Dec 2021 01:56:38 +0000
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
Lines: 37
 by: William Gallant - Tue, 21 Dec 2021 01:56 UTC

Compiling the "8080b.c" using tcc
with signals() commented out and fgets replacing gets
on Windows 11 machine gives this error:

8080b.c:133: incompatible types for redefinition of 'fgets'

I set up Ubunto 20.04.3 under Oracle VM and tried gcc using the
same 8080b.c and the reply was:

wfg@wfg-VirtualBox:~/empl$ gcc 8080b.c
8080b.c:133:7: error: conflicting types for ‘fgets’
133 | char* fgets(char*);
| ^~~~~
In file included from 8080b.c:16:
/usr/include/stdio.h:564:14: note: previous declaration of ‘fgets’ was here
564 | extern char *fgets (char *__restrict __s, int __n, FILE *__restrict __stream)
| ^~~~~
8080b.c: In function ‘load_file’:
8080b.c:248:54: warning: format ‘%d’ expects argument of type ‘int’, but argument 3 has type ‘long int’ [-Wformat=]
248 | fprintf(stderr, "8080: error reading file, cnt = %d\n",
| ~^
| |
| int
| %ld
249 | cnt);
| ~~~
| |
| long int
wfg@wfg-VirtualBox:~/empl$

I seem to understand what's going on, i just don't have the knowledge
in my head to figure the solution in a short time. Might take me quite some time.
-- William

Re: Trouble compiling 8080 emulator written in C

<87v8zik8uc.fsf@bsb.me.uk>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=19597&group=comp.lang.c#19597

  copy link   Newsgroups: comp.lang.c
Path: i2pn2.org!i2pn.org!eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mail
From: ben.use...@bsb.me.uk (Ben Bacarisse)
Newsgroups: comp.lang.c
Subject: Re: Trouble compiling 8080 emulator written in C
Date: Tue, 21 Dec 2021 02:08:59 +0000
Organization: A noiseless patient Spider
Lines: 60
Message-ID: <87v8zik8uc.fsf@bsb.me.uk>
References: <184050e8-3d32-4fb7-a37f-89388fc7e893n@googlegroups.com>
<spr8gj$62i$1@dont-email.me> <87lf0elp6i.fsf@bsb.me.uk>
<783824d3-d70e-44ed-a250-fdb42c4b22f3n@googlegroups.com>
Mime-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 8bit
Injection-Info: reader02.eternal-september.org; posting-host="4b4f344d011d941e5ff3f27361205768";
logging-data="17848"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18GQ/iE3HwXWoYxPmld4qXo23e2KWlkoCM="
Cancel-Lock: sha1:m1OvIsA8E5xJVeUVB7uf5oe36vI=
sha1:TdOFd+nSsNVZCLKYfnx9EVg+L2A=
X-BSB-Auth: 1.202ad727d2ca08944552.20211221020859GMT.87v8zik8uc.fsf@bsb.me.uk
 by: Ben Bacarisse - Tue, 21 Dec 2021 02:08 UTC

William Gallant <sigma.research@gmail.com> writes:

> Compiling the "8080b.c" using tcc
> with signals() commented out and fgets replacing gets

There's no need to do that. Include <stdlib.h> and change

interr()

to

void interr();

(Later, you can add int to the ()s, but the above is the minimum change
that will remove the type error.)

> on Windows 11 machine gives this error:
>
> 8080b.c:133: incompatible types for redefinition of 'fgets'

Don't do that! You can't swap function about unless you know hat they
do and how. gets is bad, but leave it in until you know how to fix
problem.

> I set up Ubunto 20.04.3 under Oracle VM and tried gcc using the
> same 8080b.c and the reply was:
>
> wfg@wfg-VirtualBox:~/empl$ gcc 8080b.c
> 8080b.c:133:7: error: conflicting types for ‘fgets’
> 133 | char* fgets(char*);
> | ^~~~~
> In file included from 8080b.c:16:
> /usr/include/stdio.h:564:14: note: previous declaration of ‘fgets’ was here
> 564 | extern char *fgets (char *__restrict __s, int __n, FILE *__restrict __stream)
> | ^~~~~
> 8080b.c: In function ‘load_file’:
> 8080b.c:248:54: warning: format ‘%d’ expects argument of type ‘int’, but argument 3 has type ‘long int’ [-Wformat=]
> 248 | fprintf(stderr, "8080: error reading file, cnt = %d\n",
> | ~^
> | |
> | int
> | %ld
> 249 | cnt);
> | ~~~
> | |
> | long int

Yes, just change the %d to %ld.

> wfg@wfg-VirtualBox:~/empl$
>
> I seem to understand what's going on, i just don't have the knowledge
> in my head to figure the solution in a short time. Might take me quite some time.

Getting it to compile is one thing, but with "old C" there are often a
lot of assumptions being made, and it's also easy for the code to do
things that work on one system but break badly on another.

--
Ben.

Re: Trouble compiling 8080 emulator written in C

<sprdrd$d1$1@dont-email.me>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=19598&group=comp.lang.c#19598

  copy link   Newsgroups: comp.lang.c
Path: i2pn2.org!i2pn.org!eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mail
From: bc...@freeuk.com (Bart)
Newsgroups: comp.lang.c
Subject: Re: Trouble compiling 8080 emulator written in C
Date: Tue, 21 Dec 2021 02:23:39 +0000
Organization: A noiseless patient Spider
Lines: 39
Message-ID: <sprdrd$d1$1@dont-email.me>
References: <184050e8-3d32-4fb7-a37f-89388fc7e893n@googlegroups.com>
<spr8gj$62i$1@dont-email.me> <87lf0elp6i.fsf@bsb.me.uk>
<783824d3-d70e-44ed-a250-fdb42c4b22f3n@googlegroups.com>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
Injection-Date: Tue, 21 Dec 2021 02:23:41 -0000 (UTC)
Injection-Info: reader02.eternal-september.org; posting-host="7769fdff9b1bf774db912ea3e7184bbe";
logging-data="417"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18J6rjvChDaQ09jkTxtbq6RdSLSSHcvfI4="
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101
Thunderbird/91.4.0
Cancel-Lock: sha1:VTyLLJv3OBFCRViwHVIFJMCf8QA=
In-Reply-To: <783824d3-d70e-44ed-a250-fdb42c4b22f3n@googlegroups.com>
 by: Bart - Tue, 21 Dec 2021 02:23 UTC

On 21/12/2021 01:56, William Gallant wrote:
> Compiling the "8080b.c" using tcc
> with signals() commented out and fgets replacing gets
> on Windows 11 machine gives this error:
>
> 8080b.c:133: incompatible types for redefinition of 'fgets'
>
> I set up Ubunto 20.04.3 under Oracle VM and tried gcc using the
> same 8080b.c and the reply was:
>
> wfg@wfg-VirtualBox:~/empl$ gcc 8080b.c
> 8080b.c:133:7: error: conflicting types for ‘fgets’
> 133 | char* fgets(char*);
> | ^~~~~

You need remove that declaration of fgets() (which you changed from
gets()). I shouldn't have put it in (the 3rd compiler I used needed it).

However, changing gets to fgets elsewhere won't work; fgets uses
entirely different arguments from those used here for gets.

gets is not ideal, but just leave it; gcc and tcc should still have it.

> In file included from 8080b.c:16:
> /usr/include/stdio.h:564:14: note: previous declaration of ‘fgets’ was here
> 564 | extern char *fgets (char *__restrict __s, int __n, FILE *__restrict __stream)
> | ^~~~~
> 8080b.c: In function ‘load_file’:
> 8080b.c:248:54: warning: format ‘%d’ expects argument of type ‘int’, but argument 3 has type ‘long int’ [-Wformat=]
> 248 | fprintf(stderr, "8080: error reading file, cnt = %d\n",
> | ~^
> | |
> | int
> | %ld

I wouldn't worry about this one; on Windows both int and long are the
same size anyway. Or just change the format to "%ld".

Re: Trouble compiling 8080 emulator written in C

<5cfba800-932b-4ac2-91a8-f878f94a66e2n@googlegroups.com>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=19600&group=comp.lang.c#19600

  copy link   Newsgroups: comp.lang.c
X-Received: by 2002:a05:620a:4495:: with SMTP id x21mr786215qkp.604.1640054605683;
Mon, 20 Dec 2021 18:43:25 -0800 (PST)
X-Received: by 2002:a05:620a:2907:: with SMTP id m7mr751821qkp.151.1640054605502;
Mon, 20 Dec 2021 18:43:25 -0800 (PST)
Path: i2pn2.org!i2pn.org!weretis.net!feeder6.news.weretis.net!news.misty.com!border2.nntp.dca1.giganews.com!nntp.giganews.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.c
Date: Mon, 20 Dec 2021 18:43:25 -0800 (PST)
In-Reply-To: <sprdrd$d1$1@dont-email.me>
Injection-Info: google-groups.googlegroups.com; posting-host=65.183.150.237; posting-account=vzxIggoAAAC53erQVj401_8QIq-X6kHc
NNTP-Posting-Host: 65.183.150.237
References: <184050e8-3d32-4fb7-a37f-89388fc7e893n@googlegroups.com>
<spr8gj$62i$1@dont-email.me> <87lf0elp6i.fsf@bsb.me.uk> <783824d3-d70e-44ed-a250-fdb42c4b22f3n@googlegroups.com>
<sprdrd$d1$1@dont-email.me>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <5cfba800-932b-4ac2-91a8-f878f94a66e2n@googlegroups.com>
Subject: Re: Trouble compiling 8080 emulator written in C
From: sigma.re...@gmail.com (William Gallant)
Injection-Date: Tue, 21 Dec 2021 02:43:25 +0000
Content-Type: text/plain; charset="UTF-8"
Lines: 8
 by: William Gallant - Tue, 21 Dec 2021 02:43 UTC

tcc on windows now only gives:

tcc: undefined symbol 'opterr' --- Line 157
tcc: undefined symbol 'getopt' --- Line 132
tcc: undefined symbol 'optarg' --- Line 158

They seem to be defined ???

--- William

Re: Trouble compiling 8080 emulator written in C

<87czlq63lq.fsf@nosuchdomain.example.com>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=19601&group=comp.lang.c#19601

  copy link   Newsgroups: comp.lang.c
Path: i2pn2.org!i2pn.org!eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mail
From: Keith.S....@gmail.com (Keith Thompson)
Newsgroups: comp.lang.c
Subject: Re: Trouble compiling 8080 emulator written in C
Date: Mon, 20 Dec 2021 19:25:53 -0800
Organization: None to speak of
Lines: 60
Message-ID: <87czlq63lq.fsf@nosuchdomain.example.com>
References: <184050e8-3d32-4fb7-a37f-89388fc7e893n@googlegroups.com>
<spr8gj$62i$1@dont-email.me> <87lf0elp6i.fsf@bsb.me.uk>
<783824d3-d70e-44ed-a250-fdb42c4b22f3n@googlegroups.com>
<sprdrd$d1$1@dont-email.me>
Mime-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 8bit
Injection-Info: reader02.eternal-september.org; posting-host="f0137104e22f610b6b35515f566641fb";
logging-data="15148"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18FJBYEnLaruh87mHZKQh/g"
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.2 (gnu/linux)
Cancel-Lock: sha1:2/HEpJSbHFsQGAmNd2eMXglbcS0=
sha1:ndEoZD36g/jG3T7J5vP1dIzZEZY=
 by: Keith Thompson - Tue, 21 Dec 2021 03:25 UTC

Bart <bc@freeuk.com> writes:
> On 21/12/2021 01:56, William Gallant wrote:
>> Compiling the "8080b.c" using tcc
>> with signals() commented out and fgets replacing gets
>> on Windows 11 machine gives this error:
>> 8080b.c:133: incompatible types for redefinition of 'fgets'
>> I set up Ubunto 20.04.3 under Oracle VM and tried gcc using the
>> same 8080b.c and the reply was:
>> wfg@wfg-VirtualBox:~/empl$ gcc 8080b.c
>> 8080b.c:133:7: error: conflicting types for ‘fgets’
>> 133 | char* fgets(char*);
>> | ^~~~~
>
> You need remove that declaration of fgets() (which you changed from
> gets()). I shouldn't have put it in (the 3rd compiler I used needed
> it).
>
> However, changing gets to fgets elsewhere won't work; fgets uses
> entirely different arguments from those used here for gets.
>
> gets is not ideal, but just leave it; gcc and tcc should still have it.

No, change this line:
if (gets(buf) == NULL) exit(0);
to this:
if (fgets(buf, sizeof buf, stdin) == NULL) exit(0);
The code after that only refers to the buf[0], so fgets's different
behavior with respect to '\n' is irrelevant. (The buffer is 256 bytes
presumably to make it less likely for gets() to write past the end.)

If I were going to maintain the code I probably wouldn't use either gets
or fgets, but fgets is unambiguously better than gets. Don't teach bad
habits.

>> In file included from 8080b.c:16:
>> /usr/include/stdio.h:564:14: note: previous declaration of ‘fgets’ was here
>> 564 | extern char *fgets (char *__restrict __s, int __n, FILE *__restrict __stream)
>> | ^~~~~
>> 8080b.c: In function ‘load_file’:
>> 8080b.c:248:54: warning: format ‘%d’ expects argument of type ‘int’, but argument 3 has type ‘long int’ [-Wformat=]
>> 248 | fprintf(stderr, "8080: error reading file, cnt = %d\n",
>> | ~^
>> | |
>> | int
>> | %ld
>
> I wouldn't worry about this one; on Windows both int and long are the
> same size anyway. Or just change the format to "%ld".

No, just change the format to "%ld", which it should have been in the
first place. There's no reason to do it wrong. Don't teach bad habits.

On Windows you likely don't have getopt. This is not Windows code. (It
could probably be adapted to work on windows; there are numerous ports
of getopt.)

--
Keith Thompson (The_Other_Keith) Keith.S.Thompson+u@gmail.com
Working, but not speaking, for Philips
void Void(void) { Void(); } /* The recursive call of the void */

Re: Trouble compiling 8080 emulator written in C

<878rwe63dk.fsf@nosuchdomain.example.com>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=19602&group=comp.lang.c#19602

  copy link   Newsgroups: comp.lang.c
Path: i2pn2.org!i2pn.org!eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mail
From: Keith.S....@gmail.com (Keith Thompson)
Newsgroups: comp.lang.c
Subject: Re: Trouble compiling 8080 emulator written in C
Date: Mon, 20 Dec 2021 19:30:47 -0800
Organization: None to speak of
Lines: 30
Message-ID: <878rwe63dk.fsf@nosuchdomain.example.com>
References: <184050e8-3d32-4fb7-a37f-89388fc7e893n@googlegroups.com>
<spr8gj$62i$1@dont-email.me> <87lf0elp6i.fsf@bsb.me.uk>
<783824d3-d70e-44ed-a250-fdb42c4b22f3n@googlegroups.com>
<sprdrd$d1$1@dont-email.me>
<5cfba800-932b-4ac2-91a8-f878f94a66e2n@googlegroups.com>
Mime-Version: 1.0
Content-Type: text/plain
Injection-Info: reader02.eternal-september.org; posting-host="f0137104e22f610b6b35515f566641fb";
logging-data="15148"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19rTUdDRWWkSY6sCvgydcKm"
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.2 (gnu/linux)
Cancel-Lock: sha1:1gKpGZw0Fzq4U2J3Jk9ct8zG0mM=
sha1:JoT8FBCGNx4kts1b0EqD8rl0WA4=
 by: Keith Thompson - Tue, 21 Dec 2021 03:30 UTC

William Gallant <sigma.research@gmail.com> writes:
> tcc on windows now only gives:
>
> tcc: undefined symbol 'opterr' --- Line 157
> tcc: undefined symbol 'getopt' --- Line 132
> tcc: undefined symbol 'optarg' --- Line 158
>
> They seem to be defined ???

getopt and friends are declared in <unistd.h>, which is specified by
POSIX. Windows does not support this by default.

8080.c is not entirely portable code, and apparently was never intended
to be used under Windows.

It could probably be adapted without too much difficulty. If nothing
else, you could write your own code that iterates over the argv array,
or you could use any of several Unix-like emulation layers that run on
Windows.

One possible issue: If you give it an explicit file name, it opens it in
binary mode, but otherwise it reads from stdin, which is in text mode.
Binary and text modes work the same way on Unix/POSIX/Linux, but not on
Windows. I don't know enough about how it works to say what effect that
might have.

--
Keith Thompson (The_Other_Keith) Keith.S.Thompson+u@gmail.com
Working, but not speaking, for Philips
void Void(void) { Void(); } /* The recursive call of the void */

Re: Trouble compiling 8080 emulator written in C

<sps2ah$3ga$1@dont-email.me>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=19603&group=comp.lang.c#19603

  copy link   Newsgroups: comp.lang.c
Path: i2pn2.org!i2pn.org!eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mail
From: david.br...@hesbynett.no (David Brown)
Newsgroups: comp.lang.c
Subject: Re: Trouble compiling 8080 emulator written in C
Date: Tue, 21 Dec 2021 09:13:05 +0100
Organization: A noiseless patient Spider
Lines: 41
Message-ID: <sps2ah$3ga$1@dont-email.me>
References: <184050e8-3d32-4fb7-a37f-89388fc7e893n@googlegroups.com>
<spr13u$9dt$1@dont-email.me>
<745ca925-f599-4c61-b59a-f253c333e20fn@googlegroups.com>
Mime-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 7bit
Injection-Date: Tue, 21 Dec 2021 08:13:06 -0000 (UTC)
Injection-Info: reader02.eternal-september.org; posting-host="cac0a84918e04f72addf2d8cdb67f5eb";
logging-data="3594"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/skjqfG7UIsq8WE9EVL50Oo/ZUa5e2EhM="
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101
Thunderbird/78.11.0
Cancel-Lock: sha1:56gZo7fBkeNLz89oOiTFFgzcE0k=
In-Reply-To: <745ca925-f599-4c61-b59a-f253c333e20fn@googlegroups.com>
Content-Language: en-GB
 by: David Brown - Tue, 21 Dec 2021 08:13 UTC

On 21/12/2021 00:12, William Gallant wrote:
> On Monday, December 20, 2021 at 5:46:35 PM UTC-5, Lew Pitcher wrote:
>> On Mon, 20 Dec 2021 14:36:14 -0800, William Gallant wrote:
>>
>>> I don't know "C" well, and have tried Tiny C and the old Turbo C 2.01 to
>>> get the file 8080.c compiled to work with MS-DOS, and was wondering if
>>> someone here can compile it for me ( also explain the steps ).
>> Funny, it compiles and links well enough with gcc (GCC) 5.5.0 under 64bit
>> Slackware Linux 14.2 (kernel 4.4.276). There's a ton of warnings relating
>> to the compiler's modern response to K&R style code, but the source code
>> compiles OK.
>>
>> What sort of problems are you having compiling this code?
>> --
>> Lew Pitcher
>> "In Skills, We Trust"
>
> The only error is
> line 135 - cannot cast int() ro void *(int)
>
> when i use tcc ( tiny c compiler ) on Windows 11 under PowerShell.
> I don't have a linux machine. If i were to use gcc i could use mingw
> but i don't have that and would rather somehow have an executable
> i can run under DOSBox.
> How to compile under DOSBox or powershell?
>

If you want to compile code for DOS, the best source of information that
I know of is the FreeDOS website, <https://www.freedos.org>.

If you want to try compiling a single piece of code in different ways,
with different compilers and/or different flags, then an extremely
useful resource is the online compiler at <https://godbolt.org>. It is
an online compiler, supporting a large number of tools (including tcc,
dozens of gcc versions, clang, MSVC, and others). You can paste your
code into it, then work on it (perhaps starting with Keith's suggestion
of using the correct include files) to improve it. And if you have
specific questions, you can copy-and-paste the errors and warnings, or
even make shareable links to snapshots of the page (including code,
compiler choices, etc.).

Re: Trouble compiling 8080 emulator written in C

<spsdjb$d1f$1@dont-email.me>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=19604&group=comp.lang.c#19604

  copy link   Newsgroups: comp.lang.c
Path: i2pn2.org!i2pn.org!eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mail
From: bc...@freeuk.com (Bart)
Newsgroups: comp.lang.c
Subject: Re: Trouble compiling 8080 emulator written in C
Date: Tue, 21 Dec 2021 11:25:30 +0000
Organization: A noiseless patient Spider
Lines: 38
Message-ID: <spsdjb$d1f$1@dont-email.me>
References: <184050e8-3d32-4fb7-a37f-89388fc7e893n@googlegroups.com>
<spr8gj$62i$1@dont-email.me> <87lf0elp6i.fsf@bsb.me.uk>
<783824d3-d70e-44ed-a250-fdb42c4b22f3n@googlegroups.com>
<sprdrd$d1$1@dont-email.me> <87czlq63lq.fsf@nosuchdomain.example.com>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Tue, 21 Dec 2021 11:25:31 -0000 (UTC)
Injection-Info: reader02.eternal-september.org; posting-host="7769fdff9b1bf774db912ea3e7184bbe";
logging-data="13359"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+tCm+B00rZ5liB0WzDVhL8AALwtXoIGrY="
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101
Thunderbird/91.4.0
Cancel-Lock: sha1:k/0AmUUfNx2ECneFJH5eMcm+hnE=
In-Reply-To: <87czlq63lq.fsf@nosuchdomain.example.com>
 by: Bart - Tue, 21 Dec 2021 11:25 UTC

On 21/12/2021 03:25, Keith Thompson wrote:
> Bart <bc@freeuk.com> writes:

>> gets is not ideal, but just leave it; gcc and tcc should still have it.
>
> No, change this line:
> if (gets(buf) == NULL) exit(0);
> to this:
> if (fgets(buf, sizeof buf, stdin) == NULL) exit(0);
> The code after that only refers to the buf[0], so fgets's different
> behavior with respect to '\n' is irrelevant. (The buffer is 256 bytes
> presumably to make it less likely for gets() to write past the end.)
>
> If I were going to maintain the code I probably wouldn't use either gets
> or fgets, but fgets is unambiguously better than gets. Don't teach bad
> habits.

The file is full of bad habits! But we're just trying to get the thing
compiled before starting to rewrite it and likely introduce extra bugs.

> No, just change the format to "%ld", which it should have been in the
> first place. There's no reason to do it wrong. Don't teach bad habits.
>
> On Windows you likely don't have getopt. This is not Windows code.

Evidently not. But there is nothing OS-specific about an application
like this. An 8080 will work the same way whatever OS the emulator runs
under.

> (It
> could probably be adapted to work on windows; there are numerous ports
> of getopt.)
>

gcc/tdm apparently can link with getopt. My version works; I just don't
have a suitable 8080 program for it.

Re: Trouble compiling 8080 emulator written in C

<d95d73c4-96d4-4b44-82df-f01bcce92103n@googlegroups.com>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=19605&group=comp.lang.c#19605

  copy link   Newsgroups: comp.lang.c
X-Received: by 2002:ac8:5e4d:: with SMTP id i13mr2184012qtx.232.1640094259180;
Tue, 21 Dec 2021 05:44:19 -0800 (PST)
X-Received: by 2002:a05:620a:44c1:: with SMTP id y1mr1993726qkp.187.1640094258993;
Tue, 21 Dec 2021 05:44:18 -0800 (PST)
Path: i2pn2.org!i2pn.org!weretis.net!feeder6.news.weretis.net!news.misty.com!border2.nntp.dca1.giganews.com!border1.nntp.dca1.giganews.com!nntp.giganews.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.c
Date: Tue, 21 Dec 2021 05:44:18 -0800 (PST)
In-Reply-To: <sps2ah$3ga$1@dont-email.me>
Injection-Info: google-groups.googlegroups.com; posting-host=2003:f7:1f26:2c9b:c04a:11fb:b9bd:dfce;
posting-account=AqNUYgoAAADmkK2pN-RKms8sww57W0Iw
NNTP-Posting-Host: 2003:f7:1f26:2c9b:c04a:11fb:b9bd:dfce
References: <184050e8-3d32-4fb7-a37f-89388fc7e893n@googlegroups.com>
<spr13u$9dt$1@dont-email.me> <745ca925-f599-4c61-b59a-f253c333e20fn@googlegroups.com>
<sps2ah$3ga$1@dont-email.me>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <d95d73c4-96d4-4b44-82df-f01bcce92103n@googlegroups.com>
Subject: Re: Trouble compiling 8080 emulator written in C
From: minfo...@arcor.de (minf...@arcor.de)
Injection-Date: Tue, 21 Dec 2021 13:44:19 +0000
Content-Type: text/plain; charset="UTF-8"
Lines: 32
 by: minf...@arcor.de - Tue, 21 Dec 2021 13:44 UTC

David Brown schrieb am Dienstag, 21. Dezember 2021 um 09:13:17 UTC+1:
> On 21/12/2021 00:12, William Gallant wrote:
> > On Monday, December 20, 2021 at 5:46:35 PM UTC-5, Lew Pitcher wrote:
> >> On Mon, 20 Dec 2021 14:36:14 -0800, William Gallant wrote:
> >>
> >>> I don't know "C" well, and have tried Tiny C and the old Turbo C 2.01 to
> >>> get the file 8080.c compiled to work with MS-DOS, and was wondering if
> >>> someone here can compile it for me ( also explain the steps ).
> >> Funny, it compiles and links well enough with gcc (GCC) 5.5.0 under 64bit
> >> Slackware Linux 14.2 (kernel 4.4.276). There's a ton of warnings relating
> >> to the compiler's modern response to K&R style code, but the source code
> >> compiles OK.
> >>
> >> What sort of problems are you having compiling this code?
> >> --
> >> Lew Pitcher
> >> "In Skills, We Trust"
> >
> > The only error is
> > line 135 - cannot cast int() ro void *(int)
> >
> > when i use tcc ( tiny c compiler ) on Windows 11 under PowerShell.
> > I don't have a linux machine. If i were to use gcc i could use mingw
> > but i don't have that and would rather somehow have an executable
> > i can run under DOSBox.
> > How to compile under DOSBox or powershell?
> >
> If you want to compile code for DOS, the best source of information that
> I know of is the FreeDOS website, <https://www.freedos.org>.
>

FreeDOS recommends crosscompilation to DOS through OpenWatcom.
Were I working on DOS, I'd probably use djgcc or even rewrite it for Turbo Pascal.

Re: Trouble compiling 8080 emulator written in C

<874k72550y.fsf@nosuchdomain.example.com>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=19606&group=comp.lang.c#19606

  copy link   Newsgroups: comp.lang.c
Path: i2pn2.org!i2pn.org!eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mail
From: Keith.S....@gmail.com (Keith Thompson)
Newsgroups: comp.lang.c
Subject: Re: Trouble compiling 8080 emulator written in C
Date: Tue, 21 Dec 2021 07:52:45 -0800
Organization: None to speak of
Lines: 47
Message-ID: <874k72550y.fsf@nosuchdomain.example.com>
References: <184050e8-3d32-4fb7-a37f-89388fc7e893n@googlegroups.com>
<spr8gj$62i$1@dont-email.me> <87lf0elp6i.fsf@bsb.me.uk>
<783824d3-d70e-44ed-a250-fdb42c4b22f3n@googlegroups.com>
<sprdrd$d1$1@dont-email.me> <87czlq63lq.fsf@nosuchdomain.example.com>
<spsdjb$d1f$1@dont-email.me>
Mime-Version: 1.0
Content-Type: text/plain
Injection-Info: reader02.eternal-september.org; posting-host="f0137104e22f610b6b35515f566641fb";
logging-data="28687"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18X5plOIGoQzLYUDEI1nMe4"
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.2 (gnu/linux)
Cancel-Lock: sha1:pfdl/cgi7FfrHWIx/GQPMuuTWtM=
sha1:ihTZG7c4xLmQego1Lh6WDvIiuUk=
 by: Keith Thompson - Tue, 21 Dec 2021 15:52 UTC

Bart <bc@freeuk.com> writes:
> On 21/12/2021 03:25, Keith Thompson wrote:
>> Bart <bc@freeuk.com> writes:
>>> gets is not ideal, but just leave it; gcc and tcc should still have it.
>> No, change this line:
>> if (gets(buf) == NULL) exit(0);
>> to this:
>> if (fgets(buf, sizeof buf, stdin) == NULL) exit(0);
>> The code after that only refers to the buf[0], so fgets's different
>> behavior with respect to '\n' is irrelevant. (The buffer is 256 bytes
>> presumably to make it less likely for gets() to write past the end.)
>> If I were going to maintain the code I probably wouldn't use either
>> gets
>> or fgets, but fgets is unambiguously better than gets. Don't teach bad
>> habits.
>
> The file is full of bad habits! But we're just trying to get the thing
> compiled before starting to rewrite it and likely introduce extra
> bugs.

If you look at the way the buffer is used, there's no reason not to
replace gets() by fgets().

>> No, just change the format to "%ld", which it should have been in the
>> first place. There's no reason to do it wrong. Don't teach bad habits.
>> On Windows you likely don't have getopt. This is not Windows code.
>
> Evidently not. But there is nothing OS-specific about an application
> like this. An 8080 will work the same way whatever OS the emulator
> runs under.

That has nothing to do with using the correct format string.

>> (It
>> could probably be adapted to work on windows; there are numerous ports
>> of getopt.)
>
> gcc/tdm apparently can link with getopt. My version works; I just
> don't have a suitable 8080 program for it.

Or you could probably grab a source code implementation of getopt.
There shouldn't need be anything OS-specific in its implementation.

--
Keith Thompson (The_Other_Keith) Keith.S.Thompson+u@gmail.com
Working, but not speaking, for Philips
void Void(void) { Void(); } /* The recursive call of the void */

Re: Trouble compiling 8080 emulator written in C

<spt285$1eb$1@dont-email.me>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=19607&group=comp.lang.c#19607

  copy link   Newsgroups: comp.lang.c
Path: i2pn2.org!i2pn.org!eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mail
From: thiebaud...@aol.com (Dick)
Newsgroups: comp.lang.c
Subject: Re: Trouble compiling 8080 emulator written in C
Date: Tue, 21 Dec 2021 12:17:57 -0500
Organization: A noiseless patient Spider
Lines: 4
Message-ID: <spt285$1eb$1@dont-email.me>
References: <184050e8-3d32-4fb7-a37f-89388fc7e893n@googlegroups.com>
<spr8gj$62i$1@dont-email.me> <87lf0elp6i.fsf@bsb.me.uk>
<783824d3-d70e-44ed-a250-fdb42c4b22f3n@googlegroups.com>
<sprdrd$d1$1@dont-email.me> <87czlq63lq.fsf@nosuchdomain.example.com>
<spsdjb$d1f$1@dont-email.me>
Mime-Version: 1.0
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Tue, 21 Dec 2021 17:17:57 -0000 (UTC)
Injection-Info: reader02.eternal-september.org; posting-host="5ae0efe3cfb6f35510cfaa353235f088";
logging-data="1483"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+pL3i5Hgn8NnfCMfhk+X35rzLdLbP2ZY8="
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101
Thunderbird/78.14.0
Cancel-Lock: sha1:SG8oN0PVOu8bQL4f5lvpsucoHyI=
In-Reply-To: <spsdjb$d1f$1@dont-email.me>
Content-Language: en-US
 by: Dick - Tue, 21 Dec 2021 17:17 UTC

If you install djgpp in DOS, the program compiles okay with no source
changes.
I

Re: Trouble compiling 8080 emulator written in C

<spt4qi$no6$1@gioia.aioe.org>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=19608&group=comp.lang.c#19608

  copy link   Newsgroups: comp.lang.c
Path: i2pn2.org!i2pn.org!aioe.org!UgLt14+w9tVHe1BtIa3HDQ.user.46.165.242.75.POSTED!not-for-mail
From: mess...@bottle.org (Guillaume)
Newsgroups: comp.lang.c
Subject: Re: Trouble compiling 8080 emulator written in C
Date: Tue, 21 Dec 2021 19:01:52 +0100
Organization: Aioe.org NNTP Server
Message-ID: <spt4qi$no6$1@gioia.aioe.org>
References: <184050e8-3d32-4fb7-a37f-89388fc7e893n@googlegroups.com>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
Injection-Info: gioia.aioe.org; logging-data="24326"; posting-host="UgLt14+w9tVHe1BtIa3HDQ.user.gioia.aioe.org"; mail-complaints-to="abuse@aioe.org";
User-Agent: Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:91.0) Gecko/20100101
Thunderbird/91.4.1
Content-Language: fr
X-Notice: Filtered by postfilter v. 0.9.2
 by: Guillaume - Tue, 21 Dec 2021 18:01 UTC

Le 20/12/2021 à 23:36, William Gallant a écrit :
> I don't know "C" well, and have tried Tiny C and the old Turbo C 2.01 to get the file 8080.c compiled to work with MS-DOS, and was wondering if someone here can compile it for me ( also explain the steps ).
>
> 8080.c located here at MSN OneDrive
> https://1drv.ms/u/s!Ak_7nwQxFkS7iHfKQT0cp9uDLt1I
>
> Thanks and
> Merry Christmas
> -- William Gallant

There are quite a few 8080 emulators these days, written in more modern
and portable C. I'd really suggest looking elsewhere.

You can try that, for instance: https://github.com/richardt94/8080_emulator

Re: Trouble compiling 8080 emulator written in C

<fc7f1ad2-e986-4ab1-b6e6-20d244c12c74n@googlegroups.com>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=19609&group=comp.lang.c#19609

  copy link   Newsgroups: comp.lang.c
X-Received: by 2002:a05:6214:d05:: with SMTP id 5mr3639266qvh.46.1640112715783;
Tue, 21 Dec 2021 10:51:55 -0800 (PST)
X-Received: by 2002:a05:620a:44c1:: with SMTP id y1mr3125183qkp.187.1640112715579;
Tue, 21 Dec 2021 10:51:55 -0800 (PST)
Path: i2pn2.org!i2pn.org!weretis.net!feeder6.news.weretis.net!news.misty.com!border2.nntp.dca1.giganews.com!nntp.giganews.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.c
Date: Tue, 21 Dec 2021 10:51:55 -0800 (PST)
In-Reply-To: <spt4qi$no6$1@gioia.aioe.org>
Injection-Info: google-groups.googlegroups.com; posting-host=65.183.150.237; posting-account=vzxIggoAAAC53erQVj401_8QIq-X6kHc
NNTP-Posting-Host: 65.183.150.237
References: <184050e8-3d32-4fb7-a37f-89388fc7e893n@googlegroups.com> <spt4qi$no6$1@gioia.aioe.org>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <fc7f1ad2-e986-4ab1-b6e6-20d244c12c74n@googlegroups.com>
Subject: Re: Trouble compiling 8080 emulator written in C
From: sigma.re...@gmail.com (William Gallant)
Injection-Date: Tue, 21 Dec 2021 18:51:55 +0000
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
Lines: 26
 by: William Gallant - Tue, 21 Dec 2021 18:51 UTC

On Tuesday, December 21, 2021 at 1:02:05 PM UTC-5, Guillaume wrote:
> Le 20/12/2021 à 23:36, William Gallant a écrit :
> > I don't know "C" well, and have tried Tiny C and the old Turbo C 2.01 to get the file 8080.c compiled to work with MS-DOS, and was wondering if someone here can compile it for me ( also explain the steps ).
> >
> > 8080.c located here at MSN OneDrive
> > https://1drv.ms/u/s!Ak_7nwQxFkS7iHfKQT0cp9uDLt1I
> >
> > Thanks and
> > Merry Christmas
> > -- William Gallant
> There are quite a few 8080 emulators these days, written in more modern
> and portable C. I'd really suggest looking elsewhere.
>
> You can try that, for instance: https://github.com/richardt94/8080_emulator

The particular 8080 emulator 8080.c is used to run "EMPL",
a vector only APL written by Erik Mueller.
The following archived webpage describes the entire package.

https://web.archive.org/web/20070220140130/http://www.signiform.com/erik/programs/empl/empl.htm

-- William

Re: Trouble compiling 8080 emulator written in C

<20211221141138.636@kylheku.com>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=19616&group=comp.lang.c#19616

  copy link   Newsgroups: comp.lang.c
Path: i2pn2.org!i2pn.org!eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mail
From: 480-992-...@kylheku.com (Kaz Kylheku)
Newsgroups: comp.lang.c
Subject: Re: Trouble compiling 8080 emulator written in C
Date: Tue, 21 Dec 2021 22:13:57 -0000 (UTC)
Organization: A noiseless patient Spider
Lines: 16
Message-ID: <20211221141138.636@kylheku.com>
References: <184050e8-3d32-4fb7-a37f-89388fc7e893n@googlegroups.com>
Injection-Date: Tue, 21 Dec 2021 22:13:57 -0000 (UTC)
Injection-Info: reader02.eternal-september.org; posting-host="d94cf64f6780438f2b40dcbf21ec94cf";
logging-data="30730"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+B5C8DTE7dqNHIITSsSVZlG73AvEEkFXg="
User-Agent: slrn/1.0.3 (Linux)
Cancel-Lock: sha1:DJPGqrUqRcTgP3nw/f3/AYnk+p0=
 by: Kaz Kylheku - Tue, 21 Dec 2021 22:13 UTC

On 2021-12-20, William Gallant <sigma.research@gmail.com> wrote:
> I don't know "C" well, and have tried Tiny C and the old Turbo C 2.01
> to get the file 8080.c compiled to work with MS-DOS, and was wondering
> if someone here can compile it for me ( also explain the steps ).

Maybe you should find another way to run 8080 code than some .c
file from 1990.

On Github, when we enter the search query "8080 emulator", there are
467 repository hits.

Chances seem good that at least one thing in there is useful.

--
TXR Programming Language: http://nongnu.org/txr
Cygnal: Cygwin Native Application Library: http://kylheku.com/cygnal

Re: Trouble compiling 8080 emulator written in C

<HpswJ.88431$JZ3.56514@fx05.iad>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=19617&group=comp.lang.c#19617

  copy link   Newsgroups: comp.lang.c
Path: i2pn2.org!i2pn.org!news.uzoreto.com!newsreader4.netcologne.de!news.netcologne.de!peer02.ams1!peer.ams1.xlned.com!news.xlned.com!peer03.iad!feed-me.highwinds-media.com!news.highwinds-media.com!fx05.iad.POSTED!not-for-mail
X-newsreader: xrn 9.03-beta-14-64bit
Sender: scott@dragon.sl.home (Scott Lurndal)
From: sco...@slp53.sl.home (Scott Lurndal)
Reply-To: slp53@pacbell.net
Subject: Re: Trouble compiling 8080 emulator written in C
Newsgroups: comp.lang.c
References: <184050e8-3d32-4fb7-a37f-89388fc7e893n@googlegroups.com> <20211221141138.636@kylheku.com>
Lines: 17
Message-ID: <HpswJ.88431$JZ3.56514@fx05.iad>
X-Complaints-To: abuse@usenetserver.com
NNTP-Posting-Date: Tue, 21 Dec 2021 22:19:19 UTC
Organization: UsenetServer - www.usenetserver.com
Date: Tue, 21 Dec 2021 22:19:19 GMT
X-Received-Bytes: 1417
 by: Scott Lurndal - Tue, 21 Dec 2021 22:19 UTC

Kaz Kylheku <480-992-1380@kylheku.com> writes:
>On 2021-12-20, William Gallant <sigma.research@gmail.com> wrote:
>> I don't know "C" well, and have tried Tiny C and the old Turbo C 2.01
>> to get the file 8080.c compiled to work with MS-DOS, and was wondering
>> if someone here can compile it for me ( also explain the steps ).
>
>Maybe you should find another way to run 8080 code than some .c
>file from 1990.
>
>On Github, when we enter the search query "8080 emulator", there are
>467 repository hits.
>
>Chances seem good that at least one thing in there is useful.

Indeed, there is one in the simh distribution:

/work/opensource/simh-master/Intel-Systems/common/i8080.c

Re: Trouble compiling 8080 emulator written in C

<sptob3$457$1@dont-email.me>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=19618&group=comp.lang.c#19618

  copy link   Newsgroups: comp.lang.c
Path: i2pn2.org!i2pn.org!eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mail
From: bc...@freeuk.com (Bart)
Newsgroups: comp.lang.c
Subject: Re: Trouble compiling 8080 emulator written in C
Date: Tue, 21 Dec 2021 23:34:59 +0000
Organization: A noiseless patient Spider
Lines: 49
Message-ID: <sptob3$457$1@dont-email.me>
References: <184050e8-3d32-4fb7-a37f-89388fc7e893n@googlegroups.com>
<spt4qi$no6$1@gioia.aioe.org>
<fc7f1ad2-e986-4ab1-b6e6-20d244c12c74n@googlegroups.com>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
Injection-Date: Tue, 21 Dec 2021 23:34:59 -0000 (UTC)
Injection-Info: reader02.eternal-september.org; posting-host="a9e4dfb7b1096005669a778dbe5310b1";
logging-data="4263"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/WJgQrG5QNbaH8EDyjQkF8gnCDrgDUH/g="
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101
Thunderbird/91.4.0
Cancel-Lock: sha1:SHqfBw/+a7ehGqdxj3jvjb7rRsE=
In-Reply-To: <fc7f1ad2-e986-4ab1-b6e6-20d244c12c74n@googlegroups.com>
 by: Bart - Tue, 21 Dec 2021 23:34 UTC

On 21/12/2021 18:51, William Gallant wrote:
> On Tuesday, December 21, 2021 at 1:02:05 PM UTC-5, Guillaume wrote:
>> Le 20/12/2021 à 23:36, William Gallant a écrit :
>>> I don't know "C" well, and have tried Tiny C and the old Turbo C 2.01 to get the file 8080.c compiled to work with MS-DOS, and was wondering if someone here can compile it for me ( also explain the steps ).
>>>
>>> 8080.c located here at MSN OneDrive
>>> https://1drv.ms/u/s!Ak_7nwQxFkS7iHfKQT0cp9uDLt1I
>>>
>>> Thanks and
>>> Merry Christmas
>>> -- William Gallant
>> There are quite a few 8080 emulators these days, written in more modern
>> and portable C. I'd really suggest looking elsewhere.
>>
>> You can try that, for instance: https://github.com/richardt94/8080_emulator
>
> The particular 8080 emulator 8080.c is used to run "EMPL",
> a vector only APL written by Erik Mueller.
> The following archived webpage describes the entire package.
>
> https://web.archive.org/web/20070220140130/http://www.signiform.com/erik/programs/empl/empl.htm

I managed to get that working using these two modifications of those
programs:

https://github.com/sal55/langs/blob/master/8080b.c
https://github.com/sal55/langs/blob/master/load.c

But they will only compile and build with gcc:

gcc 8080b.c -o8080.exe
gcc load.c -oload.exe

load.exe converts empl.hex from your link to empl.bin:

C:\c>load <empl.hex
5845 bytes (range of 5808) from 0H to 16afH

C:\c>8080 -l empl.bin
EMPL 1.0
CLEAR WS
\10
\10
1 2 3 4 5 6 7 8 9 10
+%\10
+%\10
55

(gcc/TDM on Windows 10 64-bit.)

1
server_pubkey.txt

rocksolid light 0.9.8
clearnet tor