Skip to content
Branch: master
Find file History
Latest commit 1987bb2 Aug 23, 2019
Permalink
Type Name Latest commit message Commit time
..
Failed to load latest commit information.
examples Did some refactoring and 8080 bug fixing; 'Hello world' now produces … Aug 17, 2019
rt 32-bit arithmetic works on the 8080. Aug 22, 2019
tests 32-bit arithmetic works on the 8080. Aug 22, 2019
Makefile Part of the pstack is working --- but at least for the 8080, I need t… Aug 13, 2019
README.md Update README to mention the C backend. Aug 18, 2019
arch8080.pat 32-bit arithmetic works on the 8080. Aug 22, 2019
archagc.pat Add instructions for handling pointers (because they're special). Aug 17, 2019
archc.pat Include files work; the first test builds (doesn't run on the 8080, t… Aug 18, 2019
build-c.sh Added s script for running Cowgol-to-C programs. They run! Aug 18, 2019
build-cpm.sh 32-bit arithmetic works on the 8080. Aug 22, 2019
emitter.c Resolved the 8-bit push problem (by storing 8-bit values in the upper… Aug 14, 2019
emitter.h
globals.h Include files work; the first test builds (doesn't run on the 8080, t… Aug 18, 2019
lexer.l Include files work; the first test builds (doesn't run on the 8080, t… Aug 18, 2019
libcowgol.lua The pattern generator may, or may not, produce a working matcher. Jul 27, 2019
main.c Include files work; the first test builds (doesn't run on the 8080, t… Aug 18, 2019
midcode.c Resolved the 8-bit push problem (by storing 8-bit values in the upper… Aug 14, 2019
midcode.h Lunar Lander compiles! Haven't tried running it yet, though. Jul 28, 2019
midcodes.tab Add instructions for handling pointers (because they're special). Aug 17, 2019
mkmidcodes.lua Lunar Lander compiles! Haven't tried running it yet, though. Jul 28, 2019
mkninja.sh Non-functional skeleton of a C generator. Aug 17, 2019
mkpat.lua At least some of the C code generator now works... although it produces Aug 17, 2019
parser.y Include files work; the first test builds (doesn't run on the 8080, t… Aug 18, 2019
regalloc.c 32-bit arithmetic works on the 8080. Aug 22, 2019
regalloc.h The new 8080 backend should be up to the standard of the old one. Aug 14, 2019

README.md

This is just a few simple notes on using the compiler prototype. You don't need any other bits of Cowgol --- tinycowc is completely standalone.

To build:

$ make

You need ninja, flex and bison (Posix yacc probably won't work).

Apollo Guidance Computer

To use:

$ ./tinycowc-agc lunarlander.cow

This will emit cow.data.agc and cow.code.agc. Now, use yaYUL to assemble the rt/agc/cowgol.agc file, which includes the other two files. You'll end up with a (hopefully) runnable cowgol.agc.bin file which you can load into VirtualAGC.

C backend

This generates C code which can then be compiled into an executable with a C compiler. It's intended for testing and bootstrapping. It's kinda hacky and right now probably only works on 64-bit architectures (because it assumes that pointers are eight bytes long).

To use:

$ ./build-c.sh examples/helloworld.cow

This will produce an executable called cowgol.

8080

To use:

$ ./build-cpm.sh examples/helloworld.cow

This uses tinycowc-8080, zmac and ld80 to compile the program and the (incredibly small) runtime library, and will emit a cowgol.com file which you can run on your favourite CP/M system.

You can’t perform that action at this time.