http://perso.b2b2c.ca/~sarrazip/dev/cmoc.html CMOC Permalink: http://sarrazip.com/dev/cmoc.html By Pierre Sarrazin CMOC is a 6809-generating cross-compiler for a subset of the C language. It generates assembly language code for the Motorola 6809 processor and targets the Tandy Color Computer, the Dragon computer, the Vectrex video game console, the Thomson MO and TO computers, and the OS-9 and FLEX operating systems. It runs under GNU/Linux and other Unix-like environments like Darwin and Cygwin. It requires the LWTOOLS assembler (lwasm) and linker, by William Astle. The most significant difference between CMOC and a complete C compiler is the absence of bit fields and of a complete C standard library. Floats are only usable under Color Basic. CMOC comes with a small library that serves as a starting kit. For a summary of the C features that are supported or not by CMOC, see the C Language Features section of the manual. CMOC is free software distributed under the GNU General Public License, version 3 or later, except for the files of the USim simulator, which is used for testing. The current version is 0.1.76. It was released on 2022-03-05. Release notes for 0.1.76: * Local static variables are now supported. Release notes for Release notes for Release notes for 0.1.73: 0.1.75: 0.1.74: * Added readDECBFile() * Added support * K&R C function to . This for the FLEX definitions are now function reads a Disk operating accepted, Basic floppy file system experimentally. (Bug into memory. (--flex). reports are * Added * Fixed a bug welcome.) that rejected * Minor fixes to to CMOC's standard "long int/ compile without library. It provides signed/ warnings with gcc a function that reads unsigned". 11.2.0. or writes a CoCo * Fixed a bug * No warning is issued floppy sector. with the anymore for a * Added memset16(), switch() missing return which fills a memory statement statement if the region with a 16-bit where a large last statement in word. sparse array the function body is * Minor optimizations of switch an asm{} statement, added. values would because the return generate a value will typically huge assembly be stored directly language in B or D by that sequence. inline assembly * readDECBFile() code. now returns an * Minor optimizations error code and added. has a different signature. I can be contacted (in French or English) at sarrazip at sarrazip dot com. Questions regarding the Vectrex support should be directed to Johan Van den Brande. Questions regarding the Thomson support should be directed to Dino Florenzi. Questions regarding the FLEX support should be directed to Ulrich Boetzel. For more information about FLEX, see the FLEX User Group page. For a FLEX emulator, see Flexemu. Download Compiler * LWTOOLS, by William Astle, version 4.11 or later: + Source code from the LWTOOLS page. + Ubuntu packages by Tormod Volden may be available from this page. * CMOC itself: + Source archive: cmoc-0.1.76.tar.gz. + Tormod Volden's site may have a precompiled package for Ubuntu; I have not tried these packages myself. + For Ubuntu, if the preceding page does not provide a suitable package, the one I make myself (on my 20.04 system) may be usable: cmoc_0.1.76-1.deb. This package does not include LWTOOLS. See SHA512 signatures of these and other files. Libraries and sample programs The "" icon means that the program or library is compilable and usable on the Dragon computer, at least in part. CROSS-LIB (by Fabrizio Caruso) CoCo MiniLisp (by Jamie Cho) A retro-hardware abstraction A port of Rui Ueyama's MiniLisp. layer for coding "universal" Version 0.5.0, released in demos, games and programs for October 2017, uses CMOC's hundreds of mostly 8-bit support for 32-bit arithmetic. systems. xdaliclock port (by Jamie Cho) Space Bandits (by Jamie Cho) A port of Jamie Zawinski's A work-in-progress video game xdaliclock to the CoCo. based on Space Invaders and developed with Dynosprite, an Splinter (by Jamie Cho) object oriented game engine for the CoCo 3 by Richard Goedeken. A CoCo 3 break-the-bricks video game written by Jamie Cho with newcmd (0.1.1) (Public domain) CMOC. Splinter features colorful 320x192 graphics and smooth (Published 2022-03-05.) This animation. program replaces Basic's SKIPF command with a different command hirestxt (0.3.1) (Public domain) that does something else, and is implemented in C. The new command can interpret its A library that redirects printf arguments and store output () to a software 51x24 or 42x24 values that the Basic program black-on-green PMODE 4 text can use. screen. (A sample program is included.) Optionally supports decbfile (0.1.5) (Public domain) several VT52 terminal sequences (disable this with #define (Published 2021-03-07.) Library HIRESTEXT_NO_VT52). Useful to that offers read/write access to get true lowercase, including files on a floppy disk in the Latin-1 accented characters, on Disk Basic format. It uses Disk all CoCos. Basic's sector routine by default, but can be made to use Color Verbiste (0.1.5) (GPLv3) a stand-alone version, therefore making Basic's presence A partial CoCo port of my French unnecessary. conjugator. Requires hirestxt. There is a precompiled disk BGraph (0.1.6) (Public domain) image. Details on the Verbiste home page and its CoCo section. Requires CMOC 0.1.75 or later. Graphics library that offers nobasic (0.1.10) (Public domain functions similar to Basic's *) LINE, DRAW, PAINT and CIRCLE commands. It does not assume the A program that puts the CoCo in presence of the Color Basic all-RAM mode, overwrites the interpreter. Version 0.1.6 Basic interpreter, moves the contains a new CoCo 3 driver and program and the stack to the end a demo for it. The driver takes of the 64K of RAM and redirects care of the dirty work of bank the 60 Hz interrupt, as an switching to draw to the example of a program that can 320x200x16 screen. To create a use the entire 64K of RAM. CoCo 3 drawing program, copy the Contains a disk sector read demo demo to a new C file, change the and a CoCo 3 graphics mode demo. main drawing function to make *Some code in dskcon.c comes your calls to draw(), paint(), from DECB. printText(), etc., and link your C file with BGraph. bigapp (0.1.1) (Public domain) With version 0.1.5 (2022-01-14), A demo of a program that is too Painter_init() now accepts a large to be loaded by Basic's callback to allow the user LOADM command and uses the whole program to stop the painting 64K of RAM. This demo also adds done by Painter_paint(). arbitrary data files (PMODE 4 Existing programs can just pass screens) to the .bin so that NULL for the 4th argument of this data gets loaded with the Painter_init(), to compile as code. The user calls LOADM and before. See Painter.h for EXEC on a small loader program details. that takes care of loading the large program. Requires a 64K BSound (0.1.2) (Public domain) CoCo and the decbfile library, available on this page. Library that offers a function similar to Basic's PLAY command. autostart.c (0.1.2) (Public It does not assume the presence domain) of the Color Basic interpreter. A program to be compiled as a With version 0.1.2 (2022-01-14), boot loader that goes on track Player_init() now accepts a 34, so that the CoCo's DOS callback to allow the user command will execute it. (The program to stop the music played autostart.bin file is not meant by Painter_paint(). Existing to be loaded with LOADM.) The programs can just pass NULL for program feeds Color Basic's the 3rd argument of Player_init console input with the command (), to compile as before. See RUN"*.BAS" in order to run that Player.h for details. Basic program automatically. Install this on a disk image BControl (0.1.3) (Public domain) with this command: install-coco-boot-loader foo.dsk autostart.bin (Published 2020-06-27.) Library that offers functions similar to FuncPlot (0.2.3) (GPLv3) Color Basic's INKEY$, JOYSTK and BUTTON. It does not assume the Demo program that plots a presence of the Color Basic mathematical function in PMODE 4 interpreter. It can be compiled graphics. The program implements for OS-9,althbough only the an expression parser and an RPN keyboard is supported as of this interpreter to evaluate the version. Version 0.1.3 adds user's function across an Joystick_selectAnalogMuxInputs() interval. Requires hirestxt and and Joystick_compareAxis(), BControl. which allow custom, faster axis polling. Demo of Basic variable access from a CMOC program (Public Color Eights (0.1.12) (GPLv3) domain) A card game derived from Crazy (Updated 2018-04-03.) This Eights that I wrote with CMOC. archive contains a .dsk image Uses the Cardgame library (see file that contains VARPTR.BAS below). It can be run both under and VARPTR.BIN. Type RUN"VARPTR" Disk Basic and NitrOS-9 EOU on a CoCo. The archive also (from a 32x16 terminal). Its contains the C source file, source code (with that of which is compilable under CMOC. Cardgame) can be studied as an The Basic and C listings can be example of how to develop for studied to learn how to access both OS-9 and Disk Basic. Basic variables from a CMOC program. Cardgame (0.1.10) (Public domain ) parse-coco-bin (Public domain) A PMODE 4 (card) game library. A Perl script that lists the Contains the generic code used blocks of a CoCo Disk Basic .BIN by my Color Eights game: drawing file, along with the entry and erasing cards (32x42 point. pixels), and drawing text (uppercase 32x24 grid), in a Bouncy Ball (by Lee Patterson) PMODE 4 screen. Beep and "white noise" functions. Rename A game for all CoCos. (It does cardgame.c to something else, not come with the source code.) fill main() and code other functions. The 8x8 text font can CoCoTair: an 8080 emulator (by be reused independently, as done Mark Sherman) by cc3dblb (see below). This library can be compiled for This was Mark's Retrochallenge OS-9, but the sound features are in 2017. This emulator can be not supported as of this used to run Altair BASIC. (To version. Version 0.1.10 adds compile with CMOC 0.1.66 or drawCharWithoutMovingCursor(), later, the makefile of this moveCursorLeft(), project must be edited to remove invertCharAtCursor(), the --a09=a09 options passed to waitForKeyWithAnimatedCursor(), CMOC.) readLineFromKeyboard(), runPMode4GameDoubleBufferLoop(). DwTerm (by Michael Furman) cc3dblb (0.1.1) (Public domain) A DriveWire 4 Terminal Program for the Disk Basic environment. A skeleton for a CoCo 3 Can be used with other double-buffering game. Start a DriveWire-related programs new game project by renaming the written by Michael. files, then recode the onFlip() function. Uses the 8x8 text font from the Cardgame library to print text on the graphics screen. Requires Cardgame and BGraph (see above). Documentation See the manual that comes with CMOC. This manual includes instructions on building CMOC from the sources. I have written a small manual titled CMOC for BASIC Programmers, which may help Basic programmers who want a quick reference on mapping Basic constructs to their equivalents in C. As of January 2022, I am developing CMOC on an Ubuntu 20.04 GNU/Linux system using GCC 9.3.0. Building on Linux and FreeBSD The typical ./configure && make && make install sequence must be used, but on FreeBSD, gmake must be used instead of make. Building on Windows CMOC cannot currently be compiled directly as a native Windows application, but it can be compiled under Cygwin. It has been shown to work under that Unix-like environment. Cygwin is recommended over MinGW, where the pipe calls (popen()) do not behave as expected, as of Fall 2018. In particular, the apostrophes on the command lines composed by CMOC, when calling the C preprocessor, do not appear to be interpreted as they should by the shell called by popen(). Note that LWTOOLS should then also be compiled for Cygwin. Packages that were pre-built for Windows or MinGW will probably not work as CMOC expects. Building on Mac OS X The configure script should recognize that it is running on a Mac OS X system, but if it does not, the following instructions may help: * Before running configure, set the following environment variables : + export CPPFLAGS="-D__unix" + export LDFLAGS="-framework CoreFoundation" * ./configure * make Thanks to Jamie Cho for these Mac instructions. Glen Hewlett has posted an article on his blog about using CMOC from Mac OS or Linux. Other resources * My page on emulating the CoCo on a GNU/Linux system. * MESS (Multi Emulator Super System), to emulate the CoCo 3. * XRoar, a Dragon/CoCo (1 and 2) emulator by Ciaran Anscomb. * LWTOOLS: Cross-development tools for the Motorola 6809 and Hitachi 6309 microprocessors, by William Astle. * My home page. * Whaaaaaaaaat!?: I Don't Get Classical Music: A Self-Help Desperation Guide, a 2016 book by Dennis Bathory-Kitsz. --------------------------------------------------------------------- Last update to this page: 2022-03-05 18:05:38 EST5EDT