1
0
mirror of https://github.com/cc65/cc65.git synced 2024-11-02 18:06:48 +00:00
Commit Graph

385 Commits

Author SHA1 Message Date
Greg King
8a880580dc Reduced the size of the moveinit subroutine.
Made other changes that were recommended by Oliver.
* Changed its name from move_init to moveinit.
* Used self-modifying code in the subroutine.
* The INIT segment doesn't need to be optional (it's used by the start-up file).
2015-10-07 14:56:14 -04:00
Greg King
074e10d288 Adapted, to the c64 target, the INIT-segment overlay scheme from the apple2 targets.
When a program starts running, INIT is moved from one place to another place.  Then, INIT's code is executed; and, the first place is re-used for variables.  After the INIT code has finished, the second place can be re-used by the heap and the C stack.  That means that initiation code and data won't waste any RAM space after they stop being needed.
2015-10-05 05:47:43 -04:00
Greg King
b82bb4f5ba Moved two errno helper functions into separate files.
Only the function that actually is needed will be linked.  It is very useful for targets that do not have file-system I/O.
2015-09-25 14:06:58 -04:00
Greg King
dbf0adcec9 Improved longjmp() and setjmp(). 2015-09-11 14:18:22 -04:00
Greg King
9c55bd1c96 Fixed bugs in the interface for C-level interrupt handlers.
* Added an important ".code" directive.

* Import a linker-created zero-page symbol as an absolute address; then, convert it to zero-page when it is used.

Fixes bug report #198.
2015-08-26 19:33:34 -04:00
Greg King
0b6bcb565e Fixed a hardware-stack leak. 2015-07-17 20:36:56 -04:00
Greg King
146daa1d0a Made some string output functions reject an invalid NULL buffer pointer. 2015-07-09 14:46:28 -04:00
Greg King
219905c6bc Fix two string output functions' handling of their buffer-size parameter.
That parameter's type is unsigned; but, the functions return an int.  If the size is too big for a signed integer, then return an error code.
If the size is zero, then don't write anything into a buffer (the buffer pointer may be NULL).  But, do format and count the arguments.
2015-07-09 10:43:45 -04:00
Greg King
08e18c93c5 Added explicit settings of calling conventions in pointer-to-function declarations in system and library headers. 2015-06-22 00:15:48 -04:00
Greg King
38231a5cc6 Made _afailed() and uncompress() be fastcall functions. 2015-03-13 07:35:47 -04:00
Greg King
74c2415795 Changed literal zeroes of the style "#>0" into the style "#>$0000". 2014-09-10 19:15:07 -04:00
Greg King
0390c34e88 Changed multi-line C comments into another style.
The left side doesn't look unbalanced.
2014-06-30 16:51:07 -04:00
Greg King
2cc26e6e23 More conforming to the cc65 project's apparent writing style. 2014-05-23 16:52:02 -04:00
Greg King
a92f51fea5 Conformed to the cc65 project's coding style. 2014-05-23 00:35:19 -04:00
Greg King
0ec8c8cea7 Added a quoted-token parsing function. 2014-05-20 16:33:16 -04:00
Greg King
f82a43b98d Fixed the comments to say where the actual Left-Hand Side and Right-Hand Side are put.
A description of positions [left, right] is appropriate more for C code than for Assembly code.  (A description of timing [first argument, second argument] is more appropriate for the way that Assembly code is written.)
2014-05-11 10:43:06 -04:00
Greg King
228b9d1718 Added a fast subroutine to multiply two signed 8-bit numbers. 2014-05-11 01:08:27 -04:00
Oliver Schmidt
986c2248e2 Added cc65_umul8x8r16() based on umul8x8r16. 2014-03-27 21:22:02 +01:00
Oliver Schmidt
d001a6f1a0 Have _heapmaxavail() work as advertised.
The cc65 doc explicitly states that the return value of _heapmaxavail() can be used as parameter of malloc(). To actually allow for that the size of HEAP_ADMIN_SPACE has to be substracted from the raw size of the largest free heap block.
2014-02-20 21:04:11 +01:00
Oliver Schmidt
e0262750ce Have %I yield values [1..12] instead of [0..11]. 2013-12-09 19:53:54 +01:00
Emanuele Fornara
35388418fd fixed timep handling in time() 2013-10-02 20:55:01 +01:00
Christian Groessler
2051adeb4d Fix strtol 'endptr' return value. 2013-09-12 12:38:20 +02:00
Christian Groessler
5a84da0d4e Fix strtoul 'endptr' return value: It should point to the first invalid character,
not to the last valid character.
2013-09-11 21:54:50 +02:00
Greg King
0684ab7ab9 Fixed some return pointers.
$1234 pointers were returned as $3434.
2013-08-28 02:58:41 -04:00
Oliver Schmidt
85885001b1 Removed (pretty inconsistently used) tab chars from source code base. 2013-05-09 13:57:12 +02:00
Oliver Schmidt
008b4c4e1d Replaced whole bunch for Makefiles with a single generic Makefile.
- No complex shell logic.
- "Source file shadowing" for all targets via vpath.
- Dependency handling.
- True incremental build.
- Don't write into source directories.
- Easy cleanup by just removing 'wrk'.
2013-05-04 22:10:48 +02:00
Greg King
b225adaf03 Fixed isgraph() and ispunct() (macroes and library functions). 2013-05-01 16:23:47 -04:00
silverdr
deb18b8e1e typo in the doc corrected, tabs adjusted
git-svn-id: svn://svn.cc65.org/cc65/trunk@5964 b7a2c559-68d2-44c3-8de9-860c34a00d81
2013-01-15 11:30:11 +00:00
uz
6eefd591c1 Moved the string that contains the ascii representation of LONG_MIN into its
own file.


git-svn-id: svn://svn.cc65.org/cc65/trunk@5941 b7a2c559-68d2-44c3-8de9-860c34a00d81
2012-11-26 16:28:46 +00:00
uz
e04f1d8cb0 Fixed an error in calloc reported by Marc 'BlackJack' Rintsch.
git-svn-id: svn://svn.cc65.org/cc65/trunk@5932 b7a2c559-68d2-44c3-8de9-860c34a00d81
2012-11-12 23:07:02 +00:00
uz
dc4e898abd Use the new declarations from the zeropage include file. In interrupt handlers
that call C code, we don't need to save the register bank, because the C code
will save it, when needed.


git-svn-id: svn://svn.cc65.org/cc65/trunk@5909 b7a2c559-68d2-44c3-8de9-860c34a00d81
2012-11-04 15:23:05 +00:00
uz
7a0fa3ce67 Modifications for smaller code size.
git-svn-id: svn://svn.cc65.org/cc65/trunk@5777 b7a2c559-68d2-44c3-8de9-860c34a00d81
2012-07-10 20:45:16 +00:00
uz
383157e743 Size optimizations.
git-svn-id: svn://svn.cc65.org/cc65/trunk@5714 b7a2c559-68d2-44c3-8de9-860c34a00d81
2012-06-11 18:16:17 +00:00
uz
efb4cc9e37 Rearrangements for smaller size of generated code.
git-svn-id: svn://svn.cc65.org/cc65/trunk@5704 b7a2c559-68d2-44c3-8de9-860c34a00d81
2012-06-10 19:02:54 +00:00
uz
c03fd881e3 Changes for better code generation.
git-svn-id: svn://svn.cc65.org/cc65/trunk@5703 b7a2c559-68d2-44c3-8de9-860c34a00d81
2012-06-10 18:55:22 +00:00
uz
130e8fd090 Changed the code so that it better suits the code generation of the compiler
(which means, the resulting code is shorter).


git-svn-id: svn://svn.cc65.org/cc65/trunk@5702 b7a2c559-68d2-44c3-8de9-860c34a00d81
2012-06-10 18:32:38 +00:00
uz
bfd0f58686 Shortened the code.
git-svn-id: svn://svn.cc65.org/cc65/trunk@5701 b7a2c559-68d2-44c3-8de9-860c34a00d81
2012-06-10 18:25:22 +00:00
uz
9ee0fa91e6 Fixed an invalid store offset, which caused an invalid pointer as a function
result. The actual conversion was ok.


git-svn-id: svn://svn.cc65.org/cc65/trunk@5625 b7a2c559-68d2-44c3-8de9-860c34a00d81
2012-03-25 13:14:13 +00:00
uz
f059634cda Fixed an invalid store offset which resulted in random values returned by the
function.


git-svn-id: svn://svn.cc65.org/cc65/trunk@5624 b7a2c559-68d2-44c3-8de9-860c34a00d81
2012-03-25 13:13:37 +00:00
uz
285aaf8933 Patch by Stefan Haubenthal: Remove __fastcall__ in comments and/or the
function description for functions that don't take any parameters.


git-svn-id: svn://svn.cc65.org/cc65/trunk@5573 b7a2c559-68d2-44c3-8de9-860c34a00d81
2012-03-04 13:08:54 +00:00
ol.sc
7103aa04ae Added docs to set_irq / reset_irq.
git-svn-id: svn://svn.cc65.org/cc65/trunk@5415 b7a2c559-68d2-44c3-8de9-860c34a00d81
2012-01-21 12:28:23 +00:00
uz
75b83260c6 Fix wrong offset of irq vector byte used as on/off flag.
git-svn-id: svn://svn.cc65.org/cc65/trunk@5410 b7a2c559-68d2-44c3-8de9-860c34a00d81
2012-01-19 11:54:26 +00:00
ol.sc
5df392ff14 Added wrapper for C level irq handling.
git-svn-id: svn://svn.cc65.org/cc65/trunk@5408 b7a2c559-68d2-44c3-8de9-860c34a00d81
2012-01-19 00:24:13 +00:00
uz
655ffe5dcd Make the 8x32 unsigned multiplication routine C callable.
git-svn-id: svn://svn.cc65.org/cc65/trunk@5079 b7a2c559-68d2-44c3-8de9-860c34a00d81
2011-07-10 14:52:35 +00:00
uz
e531e5abd1 Removed __fastcall__ declarations for functions without parameters.
git-svn-id: svn://svn.cc65.org/cc65/trunk@5073 b7a2c559-68d2-44c3-8de9-860c34a00d81
2011-07-07 20:19:35 +00:00
uz
977c64ce01 Fixed comments. No code change.
git-svn-id: svn://svn.cc65.org/cc65/trunk@4996 b7a2c559-68d2-44c3-8de9-860c34a00d81
2011-04-25 18:49:24 +00:00
uz
a9990fbcf3 Changed priorities of destructors so atexit will be called before open files
are closed on exit, so atexit handlers may close the files themselves or
whatever is necessary for a clean shutdown.


git-svn-id: svn://svn.cc65.org/cc65/trunk@4939 b7a2c559-68d2-44c3-8de9-860c34a00d81
2011-01-28 10:55:03 +00:00
uz
f79473f53a Slightly improved memset function by Christian Krüger.
git-svn-id: svn://svn.cc65.org/cc65/trunk@4923 b7a2c559-68d2-44c3-8de9-860c34a00d81
2011-01-26 22:07:59 +00:00
uz
3afb4e4e94 Added getopt. The implementation is based on a public domain source,
originally written by Henry Spencer and supplied by Harald Arnesen.


git-svn-id: svn://svn.cc65.org/cc65/trunk@4737 b7a2c559-68d2-44c3-8de9-860c34a00d81
2010-07-10 11:28:02 +00:00
uz
131a5cad09 Renamed oserrcheck to __mappederrno. Added an additional function named
__directerrno and moved both to errno.s. Changed several sources to use these
functions. Needs testing.
                         


git-svn-id: svn://svn.cc65.org/cc65/trunk@4718 b7a2c559-68d2-44c3-8de9-860c34a00d81
2010-06-10 18:10:53 +00:00
uz
0bdc045f65 Removed a comment that was no longer correct.
git-svn-id: svn://svn.cc65.org/cc65/trunk@4716 b7a2c559-68d2-44c3-8de9-860c34a00d81
2010-06-06 14:31:24 +00:00
uz
23901280c9 Save a few bytes and cycles.
git-svn-id: svn://svn.cc65.org/cc65/trunk@4707 b7a2c559-68d2-44c3-8de9-860c34a00d81
2010-06-04 09:38:35 +00:00
uz
75fbc5c5e3 Removed maperrno() since it's no longer needed.
git-svn-id: svn://svn.cc65.org/cc65/trunk@4706 b7a2c559-68d2-44c3-8de9-860c34a00d81
2010-06-03 21:40:32 +00:00
uz
aa8f817182 Use _seterrno instead of assigning to _errno.
git-svn-id: svn://svn.cc65.org/cc65/trunk@4705 b7a2c559-68d2-44c3-8de9-860c34a00d81
2010-06-03 21:37:27 +00:00
uz
eac4711731 No need to import __seterror, since this is done in errno.inc.
git-svn-id: svn://svn.cc65.org/cc65/trunk@4704 b7a2c559-68d2-44c3-8de9-860c34a00d81
2010-06-03 21:33:55 +00:00
uz
49723f6a64 Use _errno, not errno.
git-svn-id: svn://svn.cc65.org/cc65/trunk@4703 b7a2c559-68d2-44c3-8de9-860c34a00d81
2010-06-03 21:31:06 +00:00
uz
a7f392a96f Call __seterrno and save a few bytes.
git-svn-id: svn://svn.cc65.org/cc65/trunk@4702 b7a2c559-68d2-44c3-8de9-860c34a00d81
2010-06-03 21:29:28 +00:00
uz
ef4a2e667d Call __seterrno instead of assigning to _errno and save a few bytes.
git-svn-id: svn://svn.cc65.org/cc65/trunk@4701 b7a2c559-68d2-44c3-8de9-860c34a00d81
2010-06-03 21:26:52 +00:00
uz
30920f0709 Removed the prototype for _seterrno, since it is now provided in errno.h.
git-svn-id: svn://svn.cc65.org/cc65/trunk@4700 b7a2c559-68d2-44c3-8de9-860c34a00d81
2010-06-03 21:25:17 +00:00
uz
8194408abc Set errno if the stream is in error state. Small code size improvements. Fixed
comment regarding _oserror.


git-svn-id: svn://svn.cc65.org/cc65/trunk@4699 b7a2c559-68d2-44c3-8de9-860c34a00d81
2010-06-03 21:22:51 +00:00
uz
b97986b124 Rewrote parts of the code for better error handling. fileno must set errno and
return -1 in case of an invalid argument, which it didn't until now.


git-svn-id: svn://svn.cc65.org/cc65/trunk@4698 b7a2c559-68d2-44c3-8de9-860c34a00d81
2010-06-03 21:20:10 +00:00
uz
1dabfda734 Added messages for EBADF (new) and EUNKNOWN (missing).
git-svn-id: svn://svn.cc65.org/cc65/trunk@4697 b7a2c559-68d2-44c3-8de9-860c34a00d81
2010-06-03 21:16:07 +00:00
uz
a9ba343e1b Use _seterrno instead of assigning to _errno to make the code shorter.
git-svn-id: svn://svn.cc65.org/cc65/trunk@4694 b7a2c559-68d2-44c3-8de9-860c34a00d81
2010-06-03 20:46:08 +00:00
uz
1b71d3fe42 Rewrote the code to make it somewhat shorter.
git-svn-id: svn://svn.cc65.org/cc65/trunk@4693 b7a2c559-68d2-44c3-8de9-860c34a00d81
2010-06-03 20:43:30 +00:00
uz
eacc7052eb Call _seterror instead of assigning to _errno to make the code somewhat
shorter. Fixed a comment regarding oserror/errno.


git-svn-id: svn://svn.cc65.org/cc65/trunk@4692 b7a2c559-68d2-44c3-8de9-860c34a00d81
2010-06-03 20:27:59 +00:00
uz
00222e41ab Fixed a comment regarding errno/oserror.
git-svn-id: svn://svn.cc65.org/cc65/trunk@4691 b7a2c559-68d2-44c3-8de9-860c34a00d81
2010-06-03 20:26:33 +00:00
uz
63b629b801 Call _seterrno instead of assigning to _errno to make the code shorter.
git-svn-id: svn://svn.cc65.org/cc65/trunk@4690 b7a2c559-68d2-44c3-8de9-860c34a00d81
2010-06-03 20:21:23 +00:00
uz
1ab221bd05 Don't include errno.h since it is not needed.
git-svn-id: svn://svn.cc65.org/cc65/trunk@4689 b7a2c559-68d2-44c3-8de9-860c34a00d81
2010-06-03 20:20:01 +00:00
uz
c3922228a9 Use _seterrno to make the code shorter.
git-svn-id: svn://svn.cc65.org/cc65/trunk@4688 b7a2c559-68d2-44c3-8de9-860c34a00d81
2010-06-03 20:18:43 +00:00
uz
c6831e936a Added --forget-inc-paths to the assembler command line to avoid problems if
more than one version of ca65 is installed on the machine (Spiro Trikaliotis).


git-svn-id: svn://svn.cc65.org/cc65/trunk@4530 b7a2c559-68d2-44c3-8de9-860c34a00d81
2009-12-18 11:58:50 +00:00
uz
18272c0427 Working on the division and multiplication routines.
git-svn-id: svn://svn.cc65.org/cc65/trunk@4443 b7a2c559-68d2-44c3-8de9-860c34a00d81
2009-11-04 19:41:54 +00:00
uz
655ba3e6ee Added a C callable entry point for the division routine.
git-svn-id: svn://svn.cc65.org/cc65/trunk@4442 b7a2c559-68d2-44c3-8de9-860c34a00d81
2009-11-04 18:25:29 +00:00
uz
851926b301 Add C callable special multiplication routines.
git-svn-id: svn://svn.cc65.org/cc65/trunk@4440 b7a2c559-68d2-44c3-8de9-860c34a00d81
2009-11-04 18:17:00 +00:00
uz
4e4beef8b7 Fixed the return types of the sine/cosine functions. Added comments.
git-svn-id: svn://svn.cc65.org/cc65/trunk@4402 b7a2c559-68d2-44c3-8de9-860c34a00d81
2009-10-30 14:02:24 +00:00
uz
c65925b0b9 Merged the sine/cosine routines into one file, because they're often used
together, we save some code in this case, and the sine table isn't of real use
for programs, because it contains some specialities.


git-svn-id: svn://svn.cc65.org/cc65/trunk@4400 b7a2c559-68d2-44c3-8de9-860c34a00d81
2009-10-30 09:58:11 +00:00
uz
7d453f5e11 Added fixpoint sine and cosine functions.
git-svn-id: svn://svn.cc65.org/cc65/trunk@4399 b7a2c559-68d2-44c3-8de9-860c34a00d81
2009-10-29 23:19:00 +00:00
uz
ed2767e65f Changed names of the pragmas to be identical to the corresponding command line
options. This should make use easier. The old names of the pragmas are still
available but will cause warnings.


git-svn-id: svn://svn.cc65.org/cc65/trunk@4364 b7a2c559-68d2-44c3-8de9-860c34a00d81
2009-10-14 12:55:15 +00:00
uz
e4d9fd3bd1 Fixed more bugs, shortened the code where possible.
git-svn-id: svn://svn.cc65.org/cc65/trunk@4257 b7a2c559-68d2-44c3-8de9-860c34a00d81
2009-09-28 18:39:55 +00:00
uz
6c8fab8e51 Fixed two bugs, made the sources somewhat better readable.
git-svn-id: svn://svn.cc65.org/cc65/trunk@4256 b7a2c559-68d2-44c3-8de9-860c34a00d81
2009-09-28 17:47:33 +00:00
uz
5967b4845e Let vsprintf call vsnprintf to save code.
git-svn-id: svn://svn.cc65.org/cc65/trunk@4247 b7a2c559-68d2-44c3-8de9-860c34a00d81
2009-09-27 12:18:06 +00:00
uz
067383eb6a Added an untested implementation of snprintf.
git-svn-id: svn://svn.cc65.org/cc65/trunk@4246 b7a2c559-68d2-44c3-8de9-860c34a00d81
2009-09-27 12:11:05 +00:00
uz
0b43444c26 Added an (only roughly tested) implementation of vsnprintf
git-svn-id: svn://svn.cc65.org/cc65/trunk@4245 b7a2c559-68d2-44c3-8de9-860c34a00d81
2009-09-27 12:04:36 +00:00
uz
2b50847a4c The _printf routine does not return anything.
git-svn-id: svn://svn.cc65.org/cc65/trunk@4239 b7a2c559-68d2-44c3-8de9-860c34a00d81
2009-09-26 19:20:51 +00:00
uz
0e91f15ea8 Improved memset/memcpy/memmove functions by Christian Krueger.
git-svn-id: svn://svn.cc65.org/cc65/trunk@4200 b7a2c559-68d2-44c3-8de9-860c34a00d81
2009-09-20 14:32:25 +00:00
uz
689d06929c Fixed an error in the makefile. strtoimax and strtoumax were in the wrong
list.


git-svn-id: svn://svn.cc65.org/cc65/trunk@4189 b7a2c559-68d2-44c3-8de9-860c34a00d81
2009-09-18 17:23:48 +00:00
uz
75068a6528 New strtoimax and strtoumax standard functions as aliases for strtol/strtoul.
git-svn-id: svn://svn.cc65.org/cc65/trunk@4182 b7a2c559-68d2-44c3-8de9-860c34a00d81
2009-09-17 18:37:42 +00:00
uz
5e55e1c651 Added a (currently untested) strtoul implementation. strtol and strtoul should
probably get merged somehow, because they share quite some code.


git-svn-id: svn://svn.cc65.org/cc65/trunk@4180 b7a2c559-68d2-44c3-8de9-860c34a00d81
2009-09-15 21:45:25 +00:00
uz
2f2bced531 Shrink atoi by using negeax instead of inlined code.
git-svn-id: svn://svn.cc65.org/cc65/trunk@4179 b7a2c559-68d2-44c3-8de9-860c34a00d81
2009-09-15 21:25:44 +00:00
uz
96637a8c35 Make system() fastcall like most other library functions.
git-svn-id: svn://svn.cc65.org/cc65/trunk@4178 b7a2c559-68d2-44c3-8de9-860c34a00d81
2009-09-15 21:01:20 +00:00
uz
e5996090f7 Added an implementation of strtol (stdlib.h).
git-svn-id: svn://svn.cc65.org/cc65/trunk@4177 b7a2c559-68d2-44c3-8de9-860c34a00d81
2009-09-15 20:56:08 +00:00
uz
4b84d95891 labs() is also imaxabs().
git-svn-id: svn://svn.cc65.org/cc65/trunk@4167 b7a2c559-68d2-44c3-8de9-860c34a00d81
2009-09-13 18:06:43 +00:00
uz
feb31603da Use named constants from ctype.inc instead of hard coded numeric values.
git-svn-id: svn://svn.cc65.org/cc65/trunk@3929 b7a2c559-68d2-44c3-8de9-860c34a00d81
2009-02-10 22:11:56 +00:00
uz
b6d7dba170 Removed an unused import.
git-svn-id: svn://svn.cc65.org/cc65/trunk@3928 b7a2c559-68d2-44c3-8de9-860c34a00d81
2009-02-10 22:08:43 +00:00
cpg
b68094a2f6 add strnicmp.o
git-svn-id: svn://svn.cc65.org/cc65/trunk@3924 b7a2c559-68d2-44c3-8de9-860c34a00d81
2009-02-10 19:15:51 +00:00
cpg
222a421969 initial check-in
git-svn-id: svn://svn.cc65.org/cc65/trunk@3923 b7a2c559-68d2-44c3-8de9-860c34a00d81
2009-02-10 19:15:21 +00:00
uz
0ec5268baa Made strxfrm fastcall, added docs.
git-svn-id: svn://svn.cc65.org/cc65/trunk@3895 b7a2c559-68d2-44c3-8de9-860c34a00d81
2008-08-27 20:02:48 +00:00
uz
af9286852f A label must always be followed by a statement. This wasn't checked by the
compiler before.


git-svn-id: svn://svn.cc65.org/cc65/trunk@3864 b7a2c559-68d2-44c3-8de9-860c34a00d81
2008-08-03 12:54:11 +00:00
uz
4812feb44b git-svn-id: svn://svn.cc65.org/cc65/trunk@3863 b7a2c559-68d2-44c3-8de9-860c34a00d81 2008-08-02 22:02:54 +00:00
cuz
545df804bb Renamed setoserror to seterrnofromoserror to avoid clashes.
git-svn-id: svn://svn.cc65.org/cc65/trunk@3838 b7a2c559-68d2-44c3-8de9-860c34a00d81
2008-04-15 06:55:35 +00:00
cuz
6c5c0be79f Fixed an error.
git-svn-id: svn://svn.cc65.org/cc65/trunk@3837 b7a2c559-68d2-44c3-8de9-860c34a00d81
2008-04-15 06:44:46 +00:00