Code Monkey home page Code Monkey logo

fabrizio-caruso / cross-lib Goto Github PK

View Code? Open in Web Editor NEW
306.0 24.0 30.0 37.23 MB

CROSS LIB - A universal 8-bit library and some games built with it

C 43.32% Batchfile 0.03% C++ 25.39% Assembly 5.82% Makefile 4.48% Python 3.13% Perl 0.94% Roff 6.26% BASIC 0.42% Shell 8.07% M4 0.45% HTML 1.50% Awk 0.12% VHDL 0.03% NASL 0.01% Dockerfile 0.03%
8-bit multi-platform ansi-c cross-platform cross-compiling retrocomputing c retrogaming cc65 z88dk

cross-lib's Introduction

CROSS LIB

LOGO

Cross-Lib and games that use it (e.g., Cross Chase, Cross Shoot, Cross Bomber, Cross Snake, Cross Horde, Cross Verbix)

by Fabrizio Caruso ([email protected])

The universal retro-hardware abstraction layer: Use the very same code for about 200 vintage computers, consoles, calculators and other devices.

Read the Disclaimer.


The logo was designed by Hamlet.

MSX Atari

CPC Atari

SMS GB

Atari SMS

Vic20 Vic20

THE GOAL

Cross-Lib is a retro-hardware abstraction layer for coding "universal" games with the very same code for hundreds of mostly 8-bit systems (consoles, computers, scientific calculators, hand-held consoles, arcade boards, hacked toy computers, etc.).

Cross-Lib is a WORA (Write Once Run Anywhere) framework for vintage systems, i.e., you code a game once in an abstract hardware-agnostic way and Cross-Lib produces the very same game for about 200 vintage systems.


ARTICLE ABOUT CROSS-LIB

Article in English (updated and modified version of an article published in C.A.L.L. Apple Volume 3 Number 1 (January 2023): https://github.com/Fabrizio-Caruso/CROSS-LIB/blob/master/docs/EnglishArticle.md

Article in French (first published in the French magazine "Programmez! Hors sΓ©rie #6") that describes Cross-Lib in details. https://github.com/Fabrizio-Caruso/CROSS-LIB/blob/master/docs/articles/CROSS_LIB_PUBLIC.pdf


THE GAMES

These games are the proof of the flexibility of Cross-Lib.

Play the games online:

https://github.com/Fabrizio-Caruso/CROSS-LIB/blob/master/docs/GAMES.md

  1. Stinger is a tank-shooter with several enemies, levels, power-ups and items to pick.
  2. Shuriken is somehow inspired by Pac-man and Pengo.
  3. Verbix is a Scrabble-like game that looks like Tetrix with letters.
  4. Horde is a zombie shooter with several different enemies, levels, power-ups and special items to pick.
  5. Snake is my personal re-interpretation of Nibbler (arcade game) to which I have added more game elements
  6. Bomber is a mini-game and clone of Air Attack (aka Blitz).
  7. Shoot is a shooter somehow similar to Robotron. It has many items and secrets to discover.
  8. Chase is somehow similar to Gnome Robots but in real-time game and with several items and power-ups.

CURRENTLY SUPPORTED SYSTEMS AND ARCHITECTURES

Cross-Lib can be used to build games for about 200 different vintage systems (computers, consoles, hand-helds, arcade boards, scientific pocket calculators, etc.). A partial list of the supported systems with their status is in:

https://github.com/Fabrizio-Caruso/CROSS-LIB/blob/master/docs/STATUS.md

The most significant supported vintage CPU architectures are:

  • COSMAC RCA 1802
  • Intel 8080
  • MOS 6502
  • Motorola 6803
  • Motorola 6809
  • TMS 9900
  • Zilog 80

Cross-Lib has also some experimental support for vintage 16-bit and 32-bit systems and for the native PC console.

For a more complete list of architectures you can look at:

https://github.com/Fabrizio-Caruso/CROSS-LIB/blob/master/docs/ARCHITECTURES.md


THE TOOL-CHAIN

Cross-Lib provides a full tool-chain to build universal vintage 8-bit games.

Cross-Lib components

Cross-Lib provides:

  • a library with hardware-agnostic APIs for game development;
  • scripts that convert automatically compiler-agnostic graphics assets to target-specific graphics assets formats;
  • makefiles that handle the build process;
  • the "user-friendly" script xl to manage game projects (see the subsequent sections below).

The build process

When a game is built for a specific target, the Cross-Lib tool-chain will automatically:

  1. if needed, convert the abstract graphics assets in graphics assets for the given target on the fly;
  2. compile the game code (and the target-specific game assets) by using the appropriate compiler;
  3. if needed, whenever possible, create a disk/cassette/cartridge image.

In most cases the user will just have to

  • code in C a game that uses Cross-Lib APIs;
  • draw the graphics assets;
  • run the xl script to create, build and test the game.

User

The xl script will trigger the full build process which will produce the target specific version of the project or massively build the same project for several targets (or even build several projects for one or more targets). For example for the build of a project for the sole GameBoy target we may represent the interactions of various Cross-Lib components with this diagram:

User

The compilers

Code written in C with Cross-Lib can be compiled by several different cross-compilers and natively on the PC.

The tool-chain currently supports: CC65, Z88DK (SCCZ80 and ZSDCC), CMOC, LCC1802, ACK, XTC68, GCC, GCC-Z8K, GCC-ATARI-ST, GCC-AMIGA, GCC-TI, VBCC, CC6303. For more details on the supported compilers we refer to:

https://github.com/Fabrizio-Caruso/CROSS-LIB/blob/master/docs/COMPILERS.md


PREREQUISITES

Cross-Lib is meant to be used under a POSIX environment (Windows+Cygwin, Linux, etc.).

In order to be able to build the games and tests on all default targets you need:

  • GNU make
  • python (2.x or 3.x)
  • gcc and ncurses (necessary only for native builds)
  • cross-compilers (necessary to build for vintage targets)
  • java only to build disk images for the Apple//e and Apple][ targets

For the compilers to work, you may need to add the location of their binaries to the $PATH environment variable and to add the execution rights to those binaries. If the compiler's binary cannot be found, you may have to set their paths in: src\makefiles.common\auxiliary/Makefile_compilers, e.g., Z88DK_PATH, LCC1802_PATH, etc..

For more details on the prerequisites we refer to:

https://github.com/Fabrizio-Caruso/CROSS-LIB/blob/master/docs/PREREQUISITES.md


INSTALLATION OF THE TOOL-CHAIN

The tool-chain Cross-Lib can be installed on different POSIX-compliant environments. It has been tested on:

  • Windows (7, 10) + Cygwin
  • Linux Ubuntu 18.04 under the Windows Subsystem
  • Linux (KUbuntu 18.04, Lubuntu 21.10)
  • FreeBSD 13.0

Cross-Lib itself does not require any installation. It is just a source library and scripts that is ready to use as is, by just downloading or cloning the content of this repository. For example you can do it by:

git clone https://github.com/Fabrizio-Caruso/CROSS-LIB.git

In order to use Cross-Lib you will need to install the prerequisites described in the previous section. The way these prerequisites are installed vary depending on the environment.

Under Windows + Cygwin

For Windows + Cygwin the tested and verified installation procedure uses:

Under Linux

For Linux (native or under the Windows Subsystem), the tested and verified procedure both standard repositories and installation from sources.

A detailed procedure for recent Ubuntu distributions is described here:

https://github.com/Fabrizio-Caruso/CROSS-LIB/blob/master/docs/LINUX_SETUP.md


HOW TO START

Inside the project main directory, you find the src and the build directories:

  • src contains the source code and all other files that are necessary to build the games and tests
  • build is supposed to be empty at first and it is the target directory for the build process.

First of all you need to be in the src directory. From src you can use the xl script (or the make command) to do different operations on projects.

For a description of the xl script and its parameters, take a look at the next sections.


THE xl SCRIPT

The script xl is found inside the src directory and it is meant to be used from src. Make sure that it has execution rights (chmod +x ./xl) and, for your convenience, that the current directory . is included in $PATH. Its name stands obviously for Cross-Lib as it can execute most of the operations people may want to do with Cross-Lib. It can be used to create, build, delete and perform other operations on all Cross-Lib projects (tests, built-in games and custom games).

xl is used as follows:

xl <command> <[optional] parameters>

You can display its instructions and some examples by using:

xl help <[optional] command>

where commands are build, clean, create,delete, list, help, reset.

The following sections will show how to use this script in the my common use-cases.


BUILDING PROJECTS

We recommend to use xl build to build projects. Alternatively you can use make.

Using xl build (recommended)

I recommend that you use xl build:

xl build [game_or_test_name] [optional system_name] [optional number of threads]

A convenient shortcut is using just xl as follows:

xl [project_name] [optional system_name] [optional number of threads]

The [optional system_name] parameter is the name of the target. If no target is specified then the native target (the host terminal) is implied.

The [optional number of threads] is used to specify the number of threads to use for multiple targets that can be built in parallel.

Examples:

  • xl build snake -> It builds Cross Snake for the native console by using gcc and ncurses.
  • xl build bomber atari -> It builds Cross Bomber for the Atari 8-bit target (by using the appropriate cross-compiler, i.e., CC65)
  • xl build snake vic20 -> It builds Cross Snake for the Commodore Vic 20.
  • xl build games msx -> It builds all game projects for the MSX target (by using the appropriate cross-compiler, i.e., the ones in Z88DK).
  • xl build bomber cc65_targets -> It builds Cross Bomber for all targets that use CC65.
  • xl build tests c64 -> It builds all tests for the Commodore 64 target

Remark: All binaries will be in the build directory (same depth level as src).

Using make (NOT recommended)

Using a standard make command is possible but you will get fewer options.

For game projects you can use:

make [system_name] -f ./games/[game_name]/Makefile.[game_name]

For test projects you can use:

make [system_name] -f ./tests/[test_name]/Makefile.[test_name]

For more details and examples on build instructions for both xl build and make we refer to:

https://github.com/Fabrizio-Caruso/CROSS-LIB/blob/master/docs/BUILD.md


CREATING A NEW GAME PROJECT

In order to create a new game project we can use the xl create scripts that will create the necessary initial source code files, graphic assets and Makefile inside a folder in the games folder.

The script is used as follows:

xl create [game project name] [initial code type]

where [initial code type] can be

  • helloworld or empty for initial code that only displays 'hello world'
  • game for an initial code for a standard game with a main loop and a level loop
  • apis for an initial code that uses most APIs.

Examples:

  • xl create foo -> It creates a new game project foo with a trivial code that initializes sound, input and graphics and just displays hello world on the screen.
  • xl create bar game -> It creates a new game project bar with code that initializes sound, input and graphics and contains the main loops that may be used in a standard game.
  • xl create foobar apis -> It creates a new game project foobar with code that initializes sound, input and graphics and contains code that shows how to use most APIs.

RESETTING A PROJECT BUILD

In order to remove generated graphics assets of a specific project and other temporary files that are produced during a build, you can use xl reset. Use this command if you want to regenerate the graphics assets of a specific project.

xl reset [project name]

Project-specific graphics assets and temporary files including project-specific ones are removed. Built binaries are preserved.

Example:

  • xl reset foo -> It deletes generated graphics assets and temporary files for foo.

CLEANING TEMPORARY FILES AND BINARIES

If you want to remove built binaries and temporary files that are produced during a build you can use 'xl clean'.

xl clean [optional project name]

If you provide a project name, then also project-specific temporary files are removed including generated project-specific graphics assets.

Examples:

  • xl clean -> It deletes all built binaries and some generic temporary files (not the once inside project directories).
  • xl clean foo -> It deletes the same files as xl clean and also deletes temporary files found inside the foo folder.

LISTING PROJECTS

You can list all current game and test projects with

xl list

which searches both tests and games folders for projects (both built-in and user-defined) and produces a list with all of them.


DELETING PROJECTS

Non-built-in game projects can be deleted trhough the xl delete script in a very simple way:

xl delete [game project name]

Example:

xl delete foo -> It removes the foo source code, assets and Makefile files


HARDWARE-AGNOSTIC CODE

Thanks to Cross-Lib APIs, the game code can be hardware-agnostic. Using only Cross-Lib APIs is not enough, though, as Cross-Lib covers targets that have different screen size, screen shape and targets that lack some hardware features such as graphics, colors, sounds.

ANSI C (A sub-set of)

The code has to be compiled by several different compilers that do not necessarily support the latest version of the C standard. Therefore it should be written in a sub-set of ANSI C89 that is common among all supported compilers.

This sub-set can be described as (mostly) ANSI C89 without:

  • float types;
  • struct copies, assignments, parameters (use pointers to struct instead);
  • dynamically allocated memory (malloc, free).

Moreover for performance reasons it is better to avoid recursion (as this has an extreme high cost on MOS 6502 targets).

Some C99 features are available:

  • Modern // comments are allowed.
  • stdint.h is not available but uint8_t and uint16_t are (with no need for extra include directive).

Screen size

Using Cross-Lib APIs is not enough as the screen size and shape may be different. Cross-Lib exposes a constant XSize for the width of the screen and a constant YSize for the height of the screen. Both these macros are measured in terms of numbers of tiles (see next section). The game code should rely on fractions of XSize and of YSize and never use hard-coded sizes or use conditional directives to cover all sizes. By doing so, upon compilation, the game will auto-adapt to the target's screen size.

Tile-based Graphics

Graphics in Cross-Lib is tile-based as this is the only possible graphics that can be supported by all targets. For targets with graphics, the shapes of tiles are only defined at compilation time and cannot be re-defined. So, for targets with graphics, smoothly moving sprites can only be implemented as software sprites through pre-shifted tiles.

Most targets with graphics have 8x8 pixel tiles but some other targets with graphics have different shapes. So do not implement logic that only assumes 8x8 pixel tiles (e.g. when implementing software sprites with pre-shifted tiles). If you want to support targets with no graphics (i.e., tiles are just mapped to ASCII characters), you either avoid code that depends on tile shapes or if you, you have to implement an alternative version for non-graphics targets.

For example for the game Cross Snake you can see how it is rendered on the MSX 1 (graphics, sounds, colors) and on the Game Boy (graphics, sounds but no colors):

MSX GB

For more snapshots we refer to:

https://github.com/Fabrizio-Caruso/CROSS-LIB/blob/master/docs/SNAPSHOTS.md

Colors, Sounds and Graphics

Some targets have no colors or no color on text, or no sounds, or no graphics. So do not write any logic that relies only on the presence of colors/sounds/graphics; or if you do, use conditional directives to implement an alternative logic for targets with no colors/sounds/graphics.

Learn from the built-in games and tests

Cross-Lib comes with games and tests whose code can be used to learn how to code universal games.

The code of the games is in:

https://github.com/Fabrizio-Caruso/CROSS-LIB/tree/master/src/games

The code of the examples is in:

https://github.com/Fabrizio-Caruso/CROSS-LIB/tree/master/src/examples


CROSS-LIB APIs

Cross-Lib provides several APIs that allow to code games in a hardware-agnostic way for all supported targets. The currently available APIs are described at

https://github.com/Fabrizio-Caruso/CROSS-LIB/blob/master/docs/CROSS_LIB_APIS.md


LOADING THE GAMES

In order to run the game you will have to follow a different procedure depending on whether you want to load it into an emulated system or a real system.

Loading the game into an emulated vintage system

In most cases loading an executable into an emulator is straightforward. For a detailed guide on how to load the game on several emulated systems for which the procedure is not obvious, we refer to:

https://github.com/Fabrizio-Caruso/CROSS-LIB/blob/master/docs/HOW_TO_LOAD_THE_GAME.md

Loading the game into a real vintage system

This depends on the systems and the format used to store the game. For some hints on this take a look at:

https://github.com/Fabrizio-Caruso/CROSS-LIB/blob/master/docs/HOW_TO_LOAD_THE_GAME_ON_REAL_HARDWARE.md


THE FUTURE

The main future goals are

  • improving the exposed APIs
  • supporting more cross-compilers, native compilers, systems and sub-targets
  • adding more features to Cross-Lib (e.g., more redefinable tiles, more sound effects, etc.)
  • coding more universal games and demos

ACKNOWLEDGEMENTS

Cross-Lib would not exist without the cross-compilers and the support of their developers and the support of some people who have helped me handle the input/output of some targets.

A partial list of the people who have helped in found in: https://github.com/Fabrizio-Caruso/CROSS-LIB/blob/master/docs/CREDITS.txt


LICENCE

This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software.

Permission is granted to anyone to use this software for non-commercial applications, subject to the following restrictions:

  1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required.

  2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software.

  3. This notice may not be removed or altered from any source distribution.

For example I do not authorize selling hardware, software, firmware or any other product that contains any part of Cross-Lib and/or its games (e.g., pre-loaded disks, tapes, cartridges, etc.). On the other hand I authorize people to load the games in the most convenient way for their personal use.

cross-lib's People

Contributors

alexthissen avatar fabrizio-caruso avatar groessler avatar nippur72 avatar omimakhare avatar pansk avatar polluks avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

cross-lib's Issues

MSX version fonts

In MSX version the fonts are not copied to VRAM that makes this a bit weird looking :)

xl script missing

The CROSS-LIB README says there should be a script called xl within the src subdir of CROSS-LIB but it is missing from the latest git revision.

The README says I should be able to use make instead but that doesn't work either. I tried renaming Makefile_common to Makefile but that didn't fix using make.

Laser 500 use bright colors for sprites on black background

Laser 500 has 16 RGB colors: 8 "dark" and 8 "bright" (luminosity bit 0/1).

I suggest you avoid dark coloured sprites when you have a black background.

This is how the Laser 500 palette is defined:

   setPalette( 0, 0x00, 0x00, 0x00);  // black
   setPalette( 1, 0x00, 0x00, 0xff);  // blue
   setPalette( 2, 0x00, 0x88, 0x00);  // green
   setPalette( 3, 0x00, 0x88, 0xff);  // cyan
   setPalette( 4, 0xaa, 0x00, 0x00);  // red
   setPalette( 5, 0xff, 0x00, 0xff);  // magenta
   setPalette( 6, 0x77, 0x88, 0x00);  // yellow
   setPalette( 7, 0x99, 0x99, 0x99);  // bright grey
   setPalette( 8, 0x55, 0x55, 0x55);  // dark grey
   setPalette( 9, 0x88, 0x88, 0xff);  // bright blue
   setPalette(10, 0x00, 0xff, 0x00);  // bright green
   setPalette(11, 0x44, 0xff, 0xff);  // bright cyan
   setPalette(12, 0xff, 0x44, 0x55);  // bright red
   setPalette(13, 0xff, 0x99, 0xff);  // bright magenta
   setPalette(14, 0xee, 0xff, 0x00);  // bright yellow
   setPalette(15, 0xff, 0xff, 0xff);  // white

Tools sources

Hi,
Can you put a README in tools that says where we can find the source for them?

How to build for the Sega SG 1000?

Hello Fabrizio!

What is the process for building the games for the SG 1000? It doesn't look like sg1000 has any build rules inside of Makefile_common.

Loaded question: output to emulators, webassembly + canvas?

Hello,

Awesome project. Would it ever be possible to extend the supported platform/targets, to include the browser (webassembly + canvas)?

There exist some emulators that compile well into webassembly.. emulators for hardware you already support (c64 etc). "IF" CROSS-LIB could include these emulators (and you build them using web-assembly), "and" you define in the webpage that it should auto-load that project you just built using CROSS-LIB... then you might be able to target the web.

Quite a few "ifs" and "ands" on my part, but just asking. Cheers

Wish: how about some CP/M executables ?

Your code can be compiled on an impressive number of old platforms.

CP/M was an early system that allowed the same binary executable to work on a number of machines sporting a 8080 or above (especially Z80) CPU.

It would be "fun" if you included CP/M in your targets.

FULL_cpc.cdt

Nice game, I was a little disappointed this game crashed, when I loaded it on my Emulated 464 though :(

Perhaps compile program to DSK image and delete CDT before someone tries to load on their real 464 and discover it's 6128 only.

Tried working out what would of cause this kind of crash, it almost happened as soon as the game completed loading, there was nothing obvious when I ran it with 6128 settings, so I'm guessing this game is using Direct Addresses instead of CPC Firmware, Direct Addresses unfortunately vary between 464 & 6128. Only way to resolve that problem is with code to determine which CPC is being used. The most common way is a PEEK(6) which returns a different value on the old models, unfortunately I don't know if that works on the Amstrad CPC Plus range. :(

[samcoupe] Colors are totally wrong

Some colors are totally wrong.
In particular:

  • red and green are inverted and
  • cyan is shown as purple/violet.

The screenshot below shows the problem:
image

The problem will be fixed in Z88DK.

[new feature] Laser 500 cursor key input

In Laser 500, it's more natural to use cursor arrow keys instead of IJKL.

Unfortunately Z88DK disables them by default (I will address a bugfix for that) but you can re-enable them by having the following compiler switch added to your makefile:

-pragma-define:CLIB_LASER500_SCAN_EXTRA_ROWS=1

After that, the keyboard input routine will return:

UP: 11
DOWN: 13
LEFT: 8
RIGHT: 9

that you can use in place of IJKL

xl - build issue under ubuntu 20.04.3

I've been trying to build CROSSCHASE, but I'm finding that in my set up the compilation doesn't complete.

  1. just clone https://github.com/Fabrizio-Caruso/CROSS-LIB
  2. enter src directory
  3. run xl chase spectrum_test_sdcc to compile the sdcc version
  4. run xl chase spectrum_test_sccz80 to compile the sccz80 version
  5. run in an emulator (e.g., EightOne), press a key multiple times to start the game even if the game seems frozen

I have a problem writing to my /tmp/ directory. Most of the compilation works fine (for both options), and for some other instructions you've provided, but it seems somehow the end of the xl python script it tries to access the /tmp/ directory in a different way to the way the compilers use it, and it is forbidden from writing into the directory. Probably something odd in my set up, but I haven't found out why I can't get things to complete, which is preventing me from going forward.

>:~/Z80/CROSS-LIB$ cd src
>:~/Z80/CROSS-LIB/src$ ./xl chase spectrum_test_sdcc
----------------------------
Cross-Lib `xl` helper script
----------------------------
Platform: linux2
GNU MAKE command: make
----------------------------

['./xl', 'chase', 'spectrum_test_sdcc']
Project name       : chase
Project type       : game
Number of threads  : 4
Extra optimization : 
Compiler's options : 
run command : make spectrum_test_sdcc ZSDCC_MAKEFILE_THREADS_OPTS='-j 4' ZSDCC_MAKEFILE_COMPILATION_OPTS= -f games/chase/Makefile.chase


zcc +zx -v -compiler=sdcc -SO0  \
-Icross_lib -Icross_lib/sleep -Icross_lib/display -Icross_lib/display/graphics_mode -Icross_lib/display/alt_print -Icross_lib/include -Icross_lib/sound -Icross_lib/sound/cc65/atmos -Icross_lib/sound/cc65/c264 -Icross_lib/sound/cc65/pokey -Icross_lib/sound/cc65/sid -Icross_lib/sound/cc65/vic20 -Icross_lib/sound/cc65/gamate -Icross_lib/sound/cc65/creativision -Icross_lib/sound/cc65/pet -Icross_lib/sound/z88dk/bit_bang -Icross_lib/sound/z88dk/gb -Icross_lib/sound/z88dk/psg -Icross_lib/sound/lcc1802/comx -Icross_lib/sound/cmoc/mo5 -Icross_lib/sound/generic -Icross_lib/text -Icross_lib/input -Icross_lib/rand -Icross_lib/display/redefine_characters -Icross_lib/display/tiles -Igames/chase/generated_assets -Igames/chase  \
-zorg=24055 \
-pragma-include:cross_lib/cfg//z88dk/zpragma_clib.inc \
-pragma-redirect:getk=getk_inkey \
-DLESS_TEXT -DANIMATE_PLAYER \
-DFORCE_NARROW -DNO_BLINKING \
-DFORCE_GHOSTS_NUMBER=8 \
-DNO_SLEEP -DNO_WALL \
-DNO_MESSAGE -DNO_HINTS -DNO_CONTROL_INSTRUCTIONS -DNO_SET_SCREEN_COLORS \
-DNO_TITLE_LINE -DNO_INITIAL_SCREEN \
-DNO_RANDOM_LEVEL \
-DSIMPLE_STRATEGY \
-D__SPECTRUM__ \
-DALT_MOVE \
-lndos -create-app \
-DCONIO \
-DUDG_GRAPHICS \
-pragma-redirect:fputc_cons=fputc_cons_generic \
-o ../build/WIP_LIGHT_spectrum_test_sdcc.prg \
cross_lib/display/init_graphics/z88dk/udg/udg_init_graphics.c \
games/chase/generated_assets/z88dk_xchase.asm \
cross_lib/display/display_macros.c cross_lib/input/input_macros.c cross_lib/text/text_macros.c games/chase/move_player.c games/chase/ghost.c  games/chase/level.c games/chase/character.c games/chase/game_text.c games/chase/main.c games/chase/init_images.c games/chase/strategy.c games/chase/item.c games/chase/skull.c games/chase/bullet.c  
z88dk-zpragma -zcc-opt="/tmp/tmpzccXXgnT9bf/zcc_opt.def" < "cross_lib/cfg//z88dk/zpragma_clib.inc" > /dev/null

PROCESSING cross_lib/display/init_graphics/z88dk/udg/udg_init_graphics.c
z88dk-zsdcpp -I"cross_lib" -I"cross_lib/sleep" -I"cross_lib/display" -I"cross_lib/display/graphics_mode" -I"cross_lib/display/alt_print" -I"cross_lib/include" -I"cross_lib/sound" -I"cross_lib/sound/cc65/atmos" -I"cross_lib/sound/cc65/c264" -I"cross_lib/sound/cc65/pokey" -I"cross_lib/sound/cc65/sid" -I"cross_lib/sound/cc65/vic20" -I"cross_lib/sound/cc65/gamate" -I"cross_lib/sound/cc65/creativision" -I"cross_lib/sound/cc65/pet" -I"cross_lib/sound/z88dk/bit_bang" -I"cross_lib/sound/z88dk/gb" -I"cross_lib/sound/z88dk/psg" -I"cross_lib/sound/lcc1802/comx" -I"cross_lib/sound/cmoc/mo5" -I"cross_lib/sound/generic" -I"cross_lib/text" -I"cross_lib/input" -I"cross_lib/rand" -I"cross_lib/display/redefine_characters" -I"cross_lib/display/tiles" -I"games/chase/generated_assets" -I"games/chase"  -iquote"." -D__Z88DK -D__SPECTRUM -DSPECTRUM -D__SPECTRUM__ -D__Z80 -DZ80 -DLESS_TEXT -DANIMATE_PLAYER -DFORCE_NARROW -DNO_BLINKING -DFORCE_GHOSTS_NUMBER=8 -DNO_SLEEP -DNO_WALL -DNO_MESSAGE -DNO_HINTS -DNO_CONTROL_INSTRUCTIONS -DNO_SET_SCREEN_COLORS -DNO_TITLE_LINE -DNO_INITIAL_SCREEN -DNO_RANDOM_LEVEL -DSIMPLE_STRATEGY -D__SPECTRUM__ -DALT_MOVE -DCONIO -DUDG_GRAPHICS  -D__SDCC -I"/home/phillip/Z80/z88dk/lib/config/../..//include/arch/zx" -isystem"/home/phillip/Z80/z88dk/lib/config/../..//include"    "cross_lib/display/init_graphics/z88dk/udg/udg_init_graphics.c" "/tmp/tmpXXWnRfSf.i2"
z88dk-zpragma -zcc-opt="/tmp/tmpzccXXgnT9bf/zcc_opt.def" < "/tmp/tmpXXWnRfSf.i2" > "/tmp/tmpXXWnRfSf.i"
z88dk-zsdcc --constseg rodata_compiler   -mz80 --no-optsdcc-in-asm --c1mode --emit-externs  --no-c-code-in-asm   --no-peep --peep-file "/home/phillip/Z80/z88dk/lib/config/../..//libsrc/_DEVELOPMENT/sdcc_peeph.0"  < "/tmp/tmpXXWnRfSf.i" -o "/tmp/tmpXXWnRfSf.opt"
z88dk-copt  "/home/phillip/Z80/z88dk/lib/config/../..//libsrc/_DEVELOPMENT/sdcc_opt.1" < "/tmp/tmpXXWnRfSf.op1" > "/tmp/tmpXXWnRfSf.opt"
z88dk-copt  "/home/phillip/Z80/z88dk/lib/config/../..//libsrc/_DEVELOPMENT/sdcc_opt.9" < "/tmp/tmpXXWnRfSf.opt" > "/tmp/tmpXXWnRfSf.op1"
z88dk-copt  "/home/phillip/Z80/z88dk/lib/config/../..//libsrc/_DEVELOPMENT/sdcc_opt.2" < "/tmp/tmpXXWnRfSf.op1" > "/tmp/tmpXXWnRfSf.asm"
cat "/tmp/tmpXXWnRfSf.asm" >> "/tmp/tmpXXWnRfSf.tmp"
cat "/tmp/tmpXXWnRfSf.tmp" >> "/tmp/tmpXXWnRfSf.asm"
z88dk-z80asm -I"/home/phillip/Z80/z88dk/lib/config/../..//lib/target/zx/def" -I"/tmp/tmpzccXXgnT9bf" -D__SDCC  -s  -mz80 -I"/home/phillip/Z80/z88dk/lib/config/../..//lib" "/tmp/tmpXXWnRfSf.asm"

PROCESSING games/chase/generated_assets/z88dk_xchase.asm
cat "games/chase/generated_assets/z88dk_xchase.asm" >> "/tmp/tmpXX0onSPf.asm"
cat: games/chase/generated_assets/z88dk_xchase.asm: No such file or directory
Couldn't write output file /tmp/tmpXX0onSPf.asm
make: *** [makefiles.other/chase/wip/Makefile.z88dk_wip_targets:226: spectrum_test_sdcc] Error 1
>:~/Z80/CROSS-LIB/src$ 

[z88dk-zsdcc] - testing v4.3.0

Fabrizio,

as part of testing sdcc v4.3.0, we're possibly going to replace the sdcc pre-processor with ucpp, the same one currently used by scc80.

The new sdcc pre-processor for v4.3.0 is based on gcpp-12 and it is currently not usable. For v4.2.0 (currently used by z88dk) it is based on gcpp-4.

Moving to ucpp for both compilers for z88dk would set up a limit of C99 as the standard compliance in the future.

Could you please build / test against your CROSS-LIB to see whether you encounter any issues with the new zsdcc (draft r13854) or using ucpp (C99 standard)? Using the current draft PR z88dk/z88dk#2190.

I'd be very happy to be able to pass feedback to the sdcc team, or you can raise it directly with them if you prefer.

P.

Case issue with src/Makefile.common when building c128 targets in Linux

Hi Fabrizio,

I've noticed this issue for some time, but wanted to officially get this submitted to you. When building for a c128 target, you will need to replace:

a40.ldr with A40.LDR
a40 with A40

a80.ldr with A80.LDR
a80 with A80

Thanks again for sharing this excellent project with us!

-Ron

Trying to run the game on OSI C1P emulator

I'm trying to run the game on an Ohio Scientific Challenger 1P emulator. After the loading the game the title screen appears. After hitting the space bar I see "HIGH SCORE: 000000". What should happen next?

[new feature] chase coco has no color output

Tried to fix this myself LoL.
On build: xl chase coco
-D_XL_NO_COLOR in build output.
So i thought i was in the right file and commented out the entry in games/chase/makefiles.chase/Makefile.cmoc_targets
next build did not have the entry, but still no color was present in game.
Things are a bit hard to follow of where exactly the config file for the target is.

Going to give newlib-6809 a look, seems a bit lighter than this,
I don't need cross development on other platforms right now, But the concept is interesting.

I started to do a little C programming using SDCC for the 8052 on some home made SBC's back in 2007
But those projects did not even require any kind of std library.

Linux developer issues.

There no tools for linux development(maybe sources of tools helps us). If there are sources - I think better will be add links to it in readme.

make ncurses

Fails with a.exe not found - there better add output file name option. Or poor-mans variang - just run a.out on unixes(may be i'll try to fix makefiles to build ncurses target on *nixes).

May be its time to sepparate library and game code bases? πŸ˜ƒ

Thank you for great library! πŸ‘

MO5/TO7 f2k5.exe is not running on Cygwin

The current compiled version require a dll that is not present in latest cygwin. ( cyggcc_s-1.dll )
Getting source code of the tool and recompiling it solved the issue.

"./xl build chase zx81" errors

I also tried with 1 thread, same result.

$ ./xl build chase z88dk_targets 1 Cross-Lib xl` helper script
Platform: cygwin
GNU MAKE command: make

Project name : chase
Project type : game
Number of threads : 1
Extra optimization :
Compiler's options :
run command : make z88dk_targets ZSDCC_MAKEFILE_THREADS_OPTS='-j 1' ZSDCC_MAKEFILE_COMPILATION_OPTS= -f games/chase/Makefile.chase

zcc.exe +ace -DFORCE_NARROW -D_DEFAULT_ASCII -Icross_lib -Icross_lib/sleep -Icross_lib/display -Icross_lib/display/graphics_mode -Icross_lib/display/alt_print -Icross_lib/include -Icross_lib/sound -Icross_lib/sound/cc65/atmos -Icross_lib/sound/cc65/c264 -Icross_lib/sound/cc65/pokey -Icross_lib/sound/cc65/sid -Icross_lib/sound/cc65/vic20 -Icross_lib/sound/cc65/gamate -Icross_lib/sound/cc65/creativision -Icross_lib/sound/cc65/pet -Icross_lib/sound/z88dk/bit_bang -Icross_lib/sound/z88dk/gb -Icross_lib/sound/z88dk/psg -Icross_lib/sound/lcc1802/comx -Icross_lib/sound/cmoc/mo5 -Icross_lib/sound/generic -Icross_lib/text -Icross_lib/input -Icross_lib/rand -Icross_lib/display/redefine_characters -Icross_lib/display/tiles -Igames/chase/generated_assets -Igames/chase
-D__ACE__ -DFULL_GAME -DBETWEEN_LEVEL -DEND_SCREEN
-DSOUNDS
-DCONIO
-clib=default
-DUDG_GRAPHICS
-DANIMATE_PLAYER
cross_lib/display/init_graphics/z88dk/udg/udg_init_graphics.c
games/chase/generated_assets/z88dk_xchase.asm
games/chase/end_screen.c
cross_lib/display/display_macros.c cross_lib/input/input_macros.c cross_lib/text/text_macros.c games/chase/move_player.c games/chase/ghost.c games/chase/level.c games/chase/character.c games/chase/game_text.c games/chase/main.c games/chase/init_images.c games/chase/strategy.c games/chase/item.c games/chase/skull.c games/chase/bullet.c games/chase/horizontal_missile.c games/chase/rocket.c
-o ace -Cz--audio -create-app
cp ace.wav ../build/Xchase_ace_exp_16k.wav
cp ace.tap ../build/Xchase_ace_exp_16k.tap
rm ace.wav
rm ace.tap
rm ace
zcc.exe +c128 -compiler=sdcc -SO3 -DFORCE_NARROW -D_DEFAULT_ASCII
-Icross_lib -Icross_lib/sleep -Icross_lib/display -Icross_lib/display/graphics_mode -Icross_lib/display/alt_print -Icross_lib/include -Icross_lib/sound -Icross_lib/sound/cc65/atmos -Icross_lib/sound/cc65/c264 -Icross_lib/sound/cc65/pokey -Icross_lib/sound/cc65/sid -Icross_lib/sound/cc65/vic20 -Icross_lib/sound/cc65/gamate -Icross_lib/sound/cc65/creativision -Icross_lib/sound/cc65/pet -Icross_lib/sound/z88dk/bit_bang -Icross_lib/sound/z88dk/gb -Icross_lib/sound/z88dk/psg -Icross_lib/sound/lcc1802/comx -Icross_lib/sound/cmoc/mo5 -Icross_lib/sound/generic -Icross_lib/text -Icross_lib/input -Icross_lib/rand -Icross_lib/display/redefine_characters -Icross_lib/display/tiles -Igames/chase/generated_assets -Igames/chase -DEXTRA_TITLE
-lndos -subtype=disk
-D__C128_Z80__ -DXSize=40
-DSOUNDS
-DFORCE_BIT_BANG
-DFULL_GAME -DEND_SCREEN -DNO_BLINKING
-DFORCE_CONIO_LIB
-DCONIO -DNO_INIT_GRAPHICS
games/chase/end_screen.c
cross_lib/display/display_macros.c cross_lib/input/input_macros.c cross_lib/text/text_macros.c games/chase/move_player.c games/chase/ghost.c games/chase/level.c games/chase/character.c games/chase/game_text.c games/chase/main.c games/chase/init_images.c games/chase/strategy.c games/chase/item.c games/chase/skull.c games/chase/bullet.c games/chase/horizontal_missile.c games/chase/rocket.c
-create-app -oa40.bin
cannot open peep rule file
copt: can't open patterns file
make: *** [games/chase/makefiles.chase/makefiles_z88dk/Makefile_z88dk_a-k:492: c128_z80_40col] Error 1

[new feature] Build tools automatically from C source for both Cygwin/Windows and Unix flavors (Linux, FreeBSD)

Automatically build tools from C source (whenever possible) for both Cygwin/Windows and Unix (Linux, FreeBSD).
This feature request also improves/fixes #280:

A tentative list of buildable tools could be:

  • bbcim (BBC)
  • elf2ea5 (TI99/4a)
  • ea5split (TI99/4a)
  • f2k5 (Mo5)
  • file2dsk (CoCo)
  • gamate-fixcart (Gamate)
  • m20 (Olivetti M20)
  • makewzd (OZ)
  • nocart (CPC)
  • sapfs (Mo5 and To7)

Workarounds:

  • c1541 (Cross-Lib when not under Windows, assumes c1541 is installed and PATH can reach it , e.g., by installing vice)

Scripts:

  • pyz80.py (used to build samcoupe .dsk images) is no longer strictlynecessary if we use appmake from Z88DK to build .mgt files

To be verified:

  • bin2abc (ABC80) - Ideal solution with abcwrite to replace all tools
  • bin2bac2 (ABC80/800) - deprecated by bin2abc
  • doscopy (ABC80/800) - deprecated by abcwrite
  • dosgen (ABC80/800) - deprecated by abcwrite
  • exomizer (currently only used by C64 in an alternative target; its source code has deps)
  • c1541 (its code seems to depend on Vice; currently only used by C128 with Z80)
  • cc1541 (it could be used instead of c1541)
  • File2VDK (Dragon) - Source code uses C Sharp
  • srec_cat (used by OSIC1P) - It needs boost library
  • ubbin2tap (MicroBEE) - I have not found the C source code
  • tap2dsk (Oric/Telestrat) - Currently unused

corrections/clarifications in documentation

https://github.com/Fabrizio-Caruso/CROSS-LIB/blob/master/docs/EnglishArticle.md

lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 22.04.2 LTS
Release: 22.04
Codename: jammy

Section:

"xl chase gcc", which will build the game Chase in turn-based mode for the native console.
should be
"./xl chase gcc"

However it fails to build
image

Extra character at the end of line 171 seems to be the issue

image

but still fails

image

./xl build chase
./xl chase
Both of these DO work

No known emulator

My EmulatorKit emulates RC2014 and SC126 if you still need emulations. The RC2014 emulation can also emulate the EF9345 and TMS9918A graphics to some extent. TMS9918A needs sprites debugging yet.

Linker error when compiling for 'mc10' target

Hello,

It looks like I'm getting a linker error when compiling for the 'mc10' target:

pi@raspberrypi:~/source/CROSS-LIB/src $ ./xl build all mc10
Python 2.x configuration
Verbose Mode ON
Color terminal ON
Config file found with: ['build', 'tools', 'extend', 'run', 'clean', 'terminal']

Detecting number of threads...
Detected 4 threads...
config.ini OK

----------------------------
Cross-Lib `xl` helper script
----------------------------
Platform: linux2
Python:   2.7
GNU MAKE command: make
----------------------------

Project name       : all
Target name        : mc10
Project type       : project
Number of threads  : 4
Extra optimization :
Compiler's options :
--------------------------
z88dk_compiler_opts    : -O3
zsdcc_compiler_opts     : -SO3
cmoc_compiler_opts      : -O2
cc65_compiler_opts      : -Or -Cl
lcc1802_compiler_opts   : "-Wf-volatile" -O "-Wp-D nofloats" "-Wa-D LCCNOLONG" "-Wf-mulcall"
gcc4ti99_compiler_opts: -O2
native_compiler_opts: -Wpedantic -Wall

Building 8 projects: shuriken bomber horde stinger verbix shoot snake chase
Going to run:
make mc10 USE_TOOLS=1  ZSDCC_MAKEFILE_THREADS_OPTS='-j 4' ZSDCC_MAKEFILE_COMPILATION_OPTS='-SO3 ' Z88DK_MAKEFILE_COMPILATION_OPTS='-O3' GCC4TI99_MAKEFILE_COMPILATION_OPTS='-O2' NATIVE_MAKEFILE_COMPILATION_OPTS='-Wpedantic -Wall' CMOC_MAKEFILE_COMPILATION_OPTS='-O2' CC65_MAKEFILE_COMPILATION_OPTS='-Or -Cl' LCC1802_MAKEFILE_COMPILATION_OPTS='"-Wf-volatile" -O "-Wp-D nofloats" "-Wa-D LCCNOLONG" "-Wf-mulcall"' _NATIVE_CC=gcc TOOL_CC=gcc -f games/shuriken/Makefile.shuriken
games/shuriken/makefiles/Makefile.override:6: warning: overriding recipe for target 'creativision'
Makefile_common:554: warning: ignoring old recipe for target 'creativision'
games/shuriken/makefiles/Makefile.override:28: warning: overriding recipe for target 'gamate'
Makefile_common:480: warning: ignoring old recipe for target 'gamate'
games/shuriken/makefiles/Makefile.override:44: warning: overriding recipe for target 'c16_16k'
Makefile_common:380: warning: ignoring old recipe for target 'c16_16k'
games/shuriken/makefiles/Makefile.override:70: warning: overriding recipe for target 'sg1000'
Makefile_common:1690: warning: ignoring old recipe for target 'sg1000'
cc68 -tmc10   -Icross_lib -Icross_lib/sleep -Icross_lib/display -Icross_lib/display/graphics_mode -Icross_lib/display/alt_print -Icross_lib/include -Icross_lib/sound -Icross_lib/sound/cc65/atmos -Icross_lib/sound/cc65/c264 -Icross_lib/sound/cc65/pokey -Icross_lib/sound/cc65/sid -Icross_lib/sound/cc65/vic20 -Icross_lib/sound/cc65/gamate -Icross_lib/sound/cc65/creativision -Icross_lib/sound/cc65/atari_lynx -Icross_lib/sound/cc65/pet -Icross_lib/sound/cc65/supervision -Icross_lib/sound/z88dk/bit_bang -Icross_lib/sound/z88dk/gb -Icross_lib/sound/z88dk/psg -Icross_lib/sound/lcc1802/comx -Icross_lib/sound/cmoc/mo5 -Icross_lib/sound/generic -Icross_lib/sound/gcc4ti99 -Icross_lib/text -Icross_lib/input -Icross_lib/rand -Icross_lib/display/redefine_characters -Icross_lib/display/tiles -Igames/shuriken/generated_assets -Igames/shuriken  \
-D__MC10__ \
 \
-DXSize=32 \
-DYSize=16 \
-D__MEMORY_MAPPED_GRAPHICS -D_XL_NO_JOYSTICK \
-D_XL_NO_COLOR -D__TARGET_SPECIFIC_ASCII \
-D__ALT_SLEEP -D__ALT_RAND \
-D__NO_INIT_GRAPHICS \
-D_XL_SLOW_DOWN_FACTOR=10*110 \
-D__DEFAULT_CLEAR_SCREEN -D__ALT_PRINT  \
cross_lib/sound/generic/bit_bang_sounds.c \
cross_lib/display/display_macros.c cross_lib/input/input_macros.c cross_lib/sleep/sleep_macros.c games/shuriken/main.c  \
cross_lib/rand/rand.c \
cross_lib/display/alt_print/memory_mapped_alt_print.c \
-o xbin
cross_lib/display/display_macros.c(564): Warning: Parameter 'color' is never used
/opt/cc68/lib/lib6803.a: Unknown symbol 'div16x16'.
/opt/cc68/lib/lib6803.a: Unknown symbol 'pop2'.
/opt/cc68/lib/lib6803.a: Unknown symbol 'div16x16'.
/opt/cc68/lib/lib6803.a: Unknown symbol 'pop2'.
/opt/cc68/lib/lib6803.a: Unknown symbol 'pop2'.
cc: /opt/cc68/bin/ld68 failed.
make: *** [Makefile_common:2663: mc10] Error 1

Built cc68 with current git repo source and just pulled from CROSS-LIB git repo as well.

Thanks for any help you can provide!

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.