CC65 Update Notes
Note: All content on this page is from Matthius Domin's old web site at www.domin-connect.de/Atari/Lynx before it was taken down.
- cc65:
- Local staticS can be initialized now.
- New variable-type : zstatic.
Variables declared zstatic are moved into the Zeropage-BSS.
- Little change in runtime.m65 :
The push-subroutine does not call another subroutine anymore. Makes things a little bit faster.
- ra65:
- Corrected ra65s handling of ldau,ldax,ldas :
Zeropage-location have been treated as absolute. - Removed a bug in symbol-handling, concerning xref and xrefzp and equ:
xrefzp lall my_lall equ lall
The label my_lall got the value 0 :).
- Corrected ra65s handling of ldau,ldax,ldas :
- link65:
- link65 will generate an error if the Zeropage-space is overun.
Note: By default Zeropage-BSS starts at $80, this can be changed to $10, if no register variables are used ! (Sure for the library !)
- link65 will generate an error if the Zeropage-space is overun.
- As of today I will stop maintaining cc65 - the old version.
But of course continue with newcc65, which has some small additional features.- Segments
The linker and assembler support 4 segments:- Zeropage : bsszp
- Code : text
- initialized data : data
- uninitialized data : bss
- Segments
- Macros in ra65
- Startaddress of BSS is free (option -B) as is of TEXT (option -b).
98/01/23
- I found out that gcc's "-s"-options has the opposite meaning. Therefor all the binaries had the complete symbol-table. Changed now. Smaller now.
- cc65 accepts now the C++ comments :
// this is a comment /* and this // also */
- I forgot to include all the documentation about cc65 in the cc65src-archive. Now it's in.
- char is of course signed and not unsigned as I wrote in the last update-notes !!
There are a lot of changes in nearly every part of the cc65-package starting with the compiler to the libraries.- directory-structure
NOTE:
I moved lynx.olb, c.olb and runtime.run to cc65/lib. - cc65
- structS can be defined like in an(s)y C. The limitation for struct-members is gone.
- register-variables are correctly saved/restored.
Note: They are saved on the 65C02-stack, so be carefull, don't declare big arrays as register. - char is now signed in any case.
Before, static and register charS where handled as unsigned char.
Note: I strongly recommend to use uchar where possible !! - Removed the optimizer (see below).
- Improved/changed the expression-handling. Now every weired expression should work.
- Added interrupt for function-declarations.
e.g.vbl() interrupt { if ( doswap ) { SwapBuffers(); doswap = 0; } }This helps the compiler to check the code.E.g no register variables are allowed during interrupts ! - Added a new command : asm( string ).
This command allows now to write 65C02-macros. It looks a lot bettern than the old #asm/#endasm way. See lynx.h for more. - Added at for global variable declarations:
e.g.unsigned char joybut at 0xfcb0;
See lynx.h for more. - The preprocessor accepts now "\" at the end of a line to append the next line.
- The preprocessor knows "#" in macro-definitions.
#define test(a) printf("Hello "#a) test(World);is expanded toprintf("Hello ""World");
- ra65
- External identifiers have to be declared using xref. Otherwise ra65 produces an "..." undefined-error.
- That's all...
- xopt
I decided to remove the optimizer and rewrite xopt. The reason is- a) xopt sees the complete file.
- b) It is easier to up-date.
- c) It was fun.
- bin2obj
Removed a bug which caused the output-file to be 1 byte to big if the input-file was a multiple of 32. - runtime.run
Some optimizations and some bug-fixes have taken place in runtime.run. Mainly to fit with cc65 but also to handle char correctly. - lynx.h
- Changed the definitions of hardware-addresses to the use of at and added a lot more.
- Added some (hopefully) usefull macros like CLI,SEI ...
- lynx.h includes now global.h and runtime.h which are needed for ra65 !
- runtime.h
This header simply includes labels.m65 from the runtime-folder which contain the xref definitions of runtime.run - lynxlib.h
This header contains prototypes for lynx.olb, variable-definitions and macros. - lynx.olb
- I added the bcd and print-routines by Matthias Domin.
- Optimized nearly all routines for speed/space.
- replaced seedrand() / genrand() with random() which is shorter and faster.
Thank you Rob !
- c.olb
- Removed the old XL-routines.
- Added memset by Matthias Domin.
- Optimized some routines.
- Added the old runtime multiplication and division routines. These are needed during interrupts.
97/07/25
- Had to change 'preproc.c' to allow #asm/#endasm within #if/#endif
- Changed 'demo.c65' (better demo0): It now uses Suzy and the lady is displayed with double size. Just check it out.
- Moved 'random.m65' from demos into 'lynx.olb'.
New functions:
seedrand(int a); int genrand();
Due to a stupid bug, the below described optimization crashed.
(Ok, I started testing after releasing, no good practice I know.)
I took the chance to start a Lynx library which currently contains :
- void SetBuffers(char * screen,char * render,char * collision)
For single-buffered, no collision call : SetBuffers(MY_SCREEN,0,0);
- void SetRGB(char * pal); with char pal[32];
Set the Lynx-palette registers. Values like in $fda0..$fdbf. - void Flip();
Flip left/right. - void SwapBuffers();
For double-buffering: Swap display-buffer <-> render-buffer - void SetPixel(int x,int y,char color);
- char GetPixel(char x,char y);
- void DrawLine(int x1,int y1,int x2,int y2,char color);
- void DrawFBox(int x1,int y1,int w,int h,char color);
I had to remove some 'improvements' I made in the last release (1997/06/10). The reason is, I inlined often used runtime-routines which effected a significant grow of the code-size, but the speed-gain was very low.
But I newly made some improvements:- Added 'register' variables, which work for all types even such as arrays and structs.
The 'registers' are a special zeropage-area from $08 to $7F. - Added new optimizations:
- x<<=const or x>>=const
The old code looked like this:
jsr pushax ldax #const jsr asltos -or- jsr asrtos
but now it looks like this
ldy #const jsr aslaxy -or- jsr asraxy
or if const == 1
jsr aslax -or- jsr asrax
But I didn't inline the single-shift-code for the above reason. - Index-calculating for arrays is optimized to use shift
- x<<=const or x>>=const








