Repository navigation
Releases: ahemphil/agonc
Release list
agonc 1.1.0-beta.2
A pre-release of agonc, 1.1.0-beta.2. Reports of anything that goes wrong are very welcome, as issues.
Shifted to C99 as default mode, changed file structure to be more compatible with other software existing on the system, and roughly doubled the speed of compiled programs with a faster runtime and library.
Install: download agonc-1.1.0-beta.2.zip below and unzip it onto the root of the Agon's SD card, merging its folders with the ones already there. Then type agonc --version at the MOS prompt. The manual, as a PDF for printing, is attached too; it is also in the repository as docs/manual.
Changes
-
agonc's library moves to
/lib/agonc, and its intermediate files to
/tmp/agonc, so that/liband/tmpstay free for other programs.
#include <agon/vdp.h>and the rest work as before, and/usrlibstays
where it is: it is your folder, which other compilers may share.
Upgrading from 1.1.0-beta.1: after unzipping the new release, delete
/lib'sassert.h,ctype.h,errno.h,float.h,limits.h,locale.h,
math.h,setjmp.h,signal.h,stdarg.h,stddef.h,stdint.h,
stdio.h,stdlib.h,string.h,time.h,crt0.s,rt.s,libc.s,
libm.s,libagon.sand the.idxfiles beside them, and the folder
/lib/agon, which agonc no longer uses. -
C99 in the default mode, all of it but variable-length arrays and
complex numbers (__STDC_VERSION__is now199901Lthere):- declarations in a
forand anywhere in a block, now without a warning
(strict mode still warns); _Bool,inline,restrict,__func__, flexible array members and
hexadecimal floating constants (0x1.8p3);- designated initialisers (
{ [2] = 1, .y = 3 }, in any order) and
compound literals ((struct point){ 1, 2 }); - variadic macros (
__VA_ARGS__) and_Pragma; snprintf,vsnprintf,vscanf,vfscanf,vsscanf,strtof,
strtold,_Exit,isblankandva_copy;printf's andscanf'shh,zandtlength modifiers and%a;
hexadecimal,infandnanread bystrtod,atofandscanf;- the headers
<stdbool.h>,<inttypes.h>and<iso646.h>; - C99's
<math.h>:cbrt,hypot,expm1,log1p,log2,exp2,
the inverse hyperbolic functions,erf,erfc,lgamma,tgamma,
the rounding functions,remainder,remquo,fmaand the rest, the
floatandlong doubleforms of every function, and the
classification and comparison macros.
Strict mode (
-ansi) is C89 as before: there,strtod("inf", &end)
still converts nothing.-std=c99and-std=gnu99select the default
mode, as gcc's makefiles expect. - declarations in a
-
Faster runtime and library, every assembly routine with its C kept
beside it or checked against a C reference:strlen,strcmp,strcpy,strcat,strchr,memcpy,
memmove,memsetandmemchruse the eZ80's block instructions:
string-heavy code runs about twice as fast.intdivision and remainder work in registers and take rounds only
for the dividend's significant bytes:x % 26about 10 times as fast.intmultiplication works in registers (about 3 times as fast), and
longmultiplication uses the eZ80's 8-bit multiply.longdivision and remainder take rounds only for the quotient's
bytes: about 12 times as fast.long longdivision is sized to its operands: about 35 times as fast
for small ones.qsortsteps through the array without multiplying: about 3 times as
fast.
Together, the benchmarks in
tests/benchrun in about half the time.
The multiply and divide helpers are now reentrant, and a C interrupt or
key handler may use any arithmetic while the main program does too.
Fixes:
- A bit-field of 9 to 16 bits was read and stored as three bytes, so a
store could undo a change to the byte after it, as in
s.field = (s.next = 1). It is now two bytes. setbuf(stdin, NULL)andsetvbuf(stdin, ..., _IONBF, ...)gave the
keyboard a one-byte buffer, which the next line of input overran. Console
input now keeps a line buffer whatever is asked.argv[argc]is now a null pointer even when all 32 entries are used.fgets(s, 1, f)returnssholding an empty string, as C requires.fsetposno longer reports an unrelated earliererrno,fopenno
longer leaveserrnoset after succeeding, andcallocandrealloc
setENOMEMwhen a request is too large, asmallocdoes.- The serial-port functions in
<agon/uart.h>keep the frame pointer
across their MOS calls. - The passes close their input when they cannot create their output, so
no MOS file handle is lost. #linerejects numbers above 8388607 instead of overflowing, and
defined(__DATE__)anddefined(__TIME__)are 1.- A call with 32 arguments is now the error the limit of 31 promises.
agonc is written by Claude (Anthropic) with Adam Hemphill; see the README.
agonc 1.1.0-beta.1
The first public release of agonc, and a beta: it passes its own tests and three free C test suites, and it has built itself on a real Agon under MOS 2.3.3, but few people have used it yet. Reports of anything that goes wrong are very welcome, as issues.
agonc compiles ANSI C89, with its whole standard library and some of C99, on the Agon Light and Console8, under MOS 2.3.3 (and MOS 3, tested on the emulator), and builds itself there.
Install: download agonc-1.1.0-beta.1.zip below and unzip it onto the root of the Agon's SD card, merging its folders with the ones already there. Then type agonc --version at the MOS prompt. The manual, as a PDF for printing, is attached too; it is also in the repository as docs/manual.
What it has:
- C89 with a conforming strict mode (
-ansi), and a default mode with C99'slong long,//comments, declarations after statements and a few other extensions. - The C89 library,
<stdint.h>, and C99'slong longfunctions; IEEE 754floatanddouble, correctly rounded, in software, with the most-used operations in assembly. <agon/mos.h>,<agon/uart.h>and<agon/vdp.h>: every MOS 2.3.3 call, the FatFS calls, the system variables, keyboard and interrupt handlers in C, the second serial port, and every documented VDU command.- An optimiser, on by default (
-O0turns it off). - Library indexes, so that a link reads only what a program uses.
- The manual, examples, and the specifications.
Known issue: the graphics contexts (vdp_context_save and the rest) send the documented commands, but a text background colour set after a save did not show as documented, on the emulator or on a real Agon.
agonc was written by Claude (Anthropic) with Adam Hemphill; see the README.