Git Product home page Git Product logo

hansake / partly-working-gcc-compiler-for-z80 Goto Github PK

View Code? Open in Web Editor NEW
4.0 4.0 1.0 12.95 MB

A not yet really working compiler for z80 built on gcc 2.95.2

Shell 1.89% HTML 0.29% Makefile 1.17% sed 0.08% Max 0.02% Perl 0.01% GDB 0.01% C++ 10.37% C 74.27% Yacc 1.37% Objective-C 0.20% GCC Machine Description 6.72% Assembly 1.05% Batchfile 0.01% JavaScript 0.01% Roff 0.97% Smarty 0.04% DIGITAL Command Language 0.07% TeX 1.43% Starlark 0.01%
gcc-cross-compiler z80 old-stuff binutils

partly-working-gcc-compiler-for-z80's Introduction

partly-working-gcc-compiler-for-z80

A not yet really working compiler for z80 built on gcc 2.95.2.

This Z80 compiler seems much more promising:

This gcc 2.95.2 compiler is patched to generate assembler code for z80. The patch is made by V.Brahmaiah and send in a mail to the [email protected] list at 25 Jun 2001: http://gcc.gnu.org/ml/gcc-patches/2001-06/msg01546/gcc-2.95.2-z80-patch.gz.

Just out of curiosity I have compiled this code with gcc 9.3.0 on a Linux Mint 20 x86_64 laptop to have a look at the z80 assembler code that is generated.

If the patched gcc compiler is built as a 32 bit i686 program it dgit diff master origin/masteroes at least not crash. However the z80 assembler code generates namy instructions that are not valid for z80. (The code is more valid for Zilog eZ80 but z80-elf-as with the -ez80 flag still gives errors on the syntax.)

Scripts for building the compiler

As the building of the compiler is not quite straight forward I created some scripts for configuration, build (make), install to a temporary directory and simple tests.

The script: ./makeandtest_gcc_z80_i686.sh will build and test the compiler for a 32 bit i686 host that generates code for the z80. The code is however not correct as indicated above.

The script: ./makeandtest_gcc_z80.sh will build and test the z80 compiler for a 64 bit x86-64 host. It can generate z80 code for some very simple test examples but will crash for almost every other C code.

The script: ./makeandtest_gcc_i686.sh will build and test the compiler for a 32 bit i686 host that generates code for a 32 bit i686 target. This was created to be able to find out which workarounds that are needed to be able to build the compiler for a 32 bit i686 host that generates code for the z80.

The other scripts: ./clearall_gcc_z80_i686.sh, ./clearall_gcc_z80.sh and ./clearall_gcc_i686.sh will remove the created build and install directories and log files.

Patch of patch

When first trying to build the cross compiler it did always crash in cc1 with signal 11. The problem seems to be that the variable "base" is not initialized in ../../gcc-2.95.2_z80/gcc/config/z80/z80.c, line 224:

case REG:
    return REGNO_OK_FOR_BASE_P2 (REGNO (base), strict);

should most probably be:

case REG:
    return REGNO_OK_FOR_BASE_P2 (REGNO (operand), strict);

copy-paste error from previous case statement?

Future plans maybe...

I will not try to make this version of the z80 compiler generate correct assembler code. If I ever will make a gcc compiler for z80 I will base it on a version of gcc that is the most recent at that time.

partly-working-gcc-compiler-for-z80's People

Contributors

hansake avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

Forkers

loesterfranco

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.