1
0
mirror of https://github.com/cc65/cc65.git synced 2024-06-21 11:29:41 +00:00
Commit Graph

422 Commits

Author SHA1 Message Date
IrgendwerA8
c95ed4b8b5 Added "popptr1" which is of common use to save some bytes. 2018-05-20 15:30:18 +02:00
Marco van den Heuvel
61e5b9d218 Changed #10 to #-basha for clarity. 2018-04-01 13:14:44 -07:00
Marco van den Heuvel
9db6f059ac Fixed cpu detection. 2018-03-31 18:59:15 -07:00
Greg King
b844572159 Moved most of the tgi_colors.s files into the libsrc/common/ directory.
Only the Apple2 and Lynx platforms use different codes for the white color; they have their own files.
2018-03-27 07:28:46 -04:00
Marco van den Heuvel
b37e06da8f Fixed hex digits case. 2018-03-02 14:09:02 -08:00
Marco van den Heuvel
5a9d908007 Added 2a03/2a07 and HuC6280 detection. 2018-03-01 14:57:42 -08:00
Marco van den Heuvel
5d029af79e Fixed the 65816/65802 detection. 2018-02-27 11:44:34 -08:00
Marco van den Heuvel
e79e779aba Removed bit opcode, not needed anymore. 2018-02-26 19:30:25 -08:00
Marco van den Heuvel
e3779978b2 Added proper 65sc02, 65ce02 and 4510 detection. 2018-02-26 19:22:54 -08:00
Oliver Schmidt
c0ce20e9cc Save/restore jmpvec as it is used by generated code - see g_callind(). 2017-10-23 18:57:28 +02:00
Oliver Schmidt
bd9b4ef60c Replaced three (logically) identical files with a single file. 2017-10-23 18:35:06 +02:00
Piotr Fusik
b31ae57be1 Make some arrays const. 2017-06-28 20:43:31 +02:00
Lauri Kasanen
4235e569d2 Small lz4 optimizations 2017-06-09 16:57:47 +03:00
Lauri Kasanen
c444ed5e4f Mention the optimizations in a comment 2017-06-09 10:42:24 +03:00
Lauri Kasanen
bba961e54d Use hex immediates 2017-06-09 10:40:17 +03:00
Lauri Kasanen
cd460a8160 Remove _ from internal vars 2017-06-09 10:37:50 +03:00
Lauri Kasanen
ee49ecdf43 Expand tabs to spaces in lz4.s 2017-06-06 19:31:16 +03:00
Lauri Kasanen
e75a59d7a8 Add LZ4 decompression support 2017-06-06 18:48:25 +03:00
Oliver Schmidt
035baa49bd Merge pull request #438 from bbbradsmith/ca65_rand_comment
rand.s comment update
2017-05-26 15:16:42 +02:00
Brad Smith
950d65e8ed detectabl > detectable 2017-05-25 03:20:11 -04:00
Brad Smith
1602aab6e9 forgot to update comments from earlier #323 rand.s change 2017-05-25 03:01:25 -04:00
Oliver Schmidt
e43dbe1c24 Just some white space fixes of recently contributed code. 2017-04-06 17:53:57 +02:00
IrgendwerA8
8d1b80e6fd Fixed CPU-flag usage which fails on build server?! 2017-03-05 11:38:55 +01:00
IrgendwerA8
81115aa826 Added further optimizations and unit tests. 2017-03-05 02:09:12 +01:00
IrgendwerA8
3d28f5ca90 Fixed indentation 2017-02-26 22:36:19 +01:00
IrgendwerA8
c240d42a9e Added "strrchr" optimizaion a matching unit test and tiny unit test framework. (Documentation for that will follow later) 2017-02-26 20:03:05 +01:00
IrgendwerA8
6afcc370ed Optimization of two string functions (size & speed). 2017-02-25 20:19:50 +01:00
Sven Oliver Moll
c0d2643952 added 4510 cpu detection to getcpu.s 2016-09-07 19:44:11 +02:00
Brad Smith
32d000fb4c Fix broken rand() implementation. The high 8 bits were unused, reducing it to a 24-bit implementation (while still doing all the work for a 32-bit one). The best entropy is in the unused high byte, returning these bits in A instead of bits 8-15, which had considerably lower entropy (i.e. rand() & 255 was effectively a 16-bit LCG). 2016-07-11 20:48:47 -04:00
Christian Groessler
94ba9575ec Implement exec() for Atari XDOS.
- Adds new ENOEXEC error code, also used by Apple2 targets.
- Maximum command line length is 40, incl. program name. This is
  an XDOS restriction.
- testcode/lib/tinyshell.c has been extended to be able to run
  programs.
2016-06-13 20:40:01 +02:00
Christian Groessler
5705d0b55b Use 'return0' for default 'doesclrscrafterexit()' implementation in libsrc/common.
Fix include/atari.h formatting.
2016-06-07 15:05:00 +02:00
Christian Groessler
346d88a6a7 Add issues from pull request #307. 2016-06-07 12:07:38 +02:00
Oliver Schmidt
1d1ba3ed3b Adjusted constructors.
The constructors are _NOT_ allowed anymore to access the BSS. Rather they must use the DATA segment or the INIT segment. The latter isn't cleared at any point so the constructors may use it to expose values to the main program. However they must make sure to always write the values as they are not pre-initialized.
2016-03-16 16:28:32 +01:00
Oliver Schmidt
419eb700b5 Renamed INITBSS to INIT and INIT to ONCE.
The way we want to use the INITBSS segment - and especially the fact that it won't have the type bss on all ROM based targets - means that the name INITBSS is misleading. After all INIT is the best name from my perspective as it serves several purposes and therefore needs a rather generic name.

Unfortunately this means that the current INIT segment needs to be renamed too. Looking for a short (ideally 4 letter) name I came up with ONCE as it contains all code (and data) accessed only once during initialization.
2016-03-06 21:27:19 +01:00
Oliver Schmidt
3d08abcfa8 Load INITBSS segment from disk.
Conceptually the INITBSS segment is not initialized in any way. Therefore it makes sense to not load it from disk. However the INIT segment has to be loaded from disk and therefore moved to its run location above the INITBSS segment. The necessary move routine increases runtime RAM usage :-(

Therefore we now "unnecessarily" load the INITBSS segment from disk too meaning that the INIT segment is loaded at its run location. Therefore there's no need for the move routine anymore.

After all we trade disk space for (runtime) RAM space - an easy decision ;-)

Notes:

- The code allowing to re-run a program without re-load present so far could not have worked as far as I can see as it only avoided to re-run the move routine but still tried to re-run the code in the INIT segment that was clobbered by zeroing the BSS. Therefore I removed the code in question altogether. I'm personally not into this "dirty re-run" but if someone wants to add an actually working solution I won't block that.

- INITBSS is intentionally not just merged with the DATA segment as ROM-based targets can't reuse the INIT segment for the BSS and therefore have no reason to place the INIT segment above INITBSS.

- Because ROM-based targets don't copy INITBSS from the ROM (like it is done with the DATA segment) all users of INITBSS _MUST_NOT_ presume INITBSS to be initialized with zeros!
2016-02-28 19:45:36 +01:00
Greg King
8e8d112029 Added pce-specific substitutes for memcpy() and memmove().
They are smaller and faster because they take advantage of the pce CPU's block-copy instructions.

Also, made a small improvement to the common memmove(), so that it is similar to the pce version.
2015-10-23 18:02:21 -04:00
Oliver Schmidt
0ee9b2e446 Changed run location of INIT segment.
So far the INIT segment was run from the later heap+stack. Now the INIT segment is run from the later BSS. The background is that so far the INIT segment was pretty small (from $80 to $180 bytes). But upcoming changes will increase the INIT segment in certain scenarios up to ~ $1000 bytes. So programs with very limited heap+stack might just not been able to move the INIT segment to its run location. But moving the INIT segment to the later BSS allows it to occupy the later BSS+heap+stack.

In order to allow that the constructors are _NOT_ allowed anymore to access the BSS. Rather they must use the DATA segment or the new INITBSS segment. The latter isn't cleared at any point so the constructors may use it to expose values to the main program. However they must make sure to always write the values as they are not pre-initialized.
2015-10-14 22:52:09 +02:00
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