1
0
mirror of https://github.com/cc65/cc65.git synced 2024-07-05 21:29:03 +00:00
Commit Graph

362 Commits

Author SHA1 Message Date
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