1
0
mirror of https://github.com/cc65/cc65.git synced 2024-06-28 19:29:53 +00:00
Commit Graph

73 Commits

Author SHA1 Message Date
Stefan
d9a6fbac48 Fixed C16 #978 2019-11-20 12:54:47 +01:00
Olli Savia
aeff90ca90 Updated to use cbm_kernal.inc. Whitespace cleanups 2018-11-26 22:14:31 +01:00
Oliver Schmidt
40f42e977f Adjusted comments to match actual prototypes. 2018-11-06 11:13:23 +01:00
Oliver Schmidt
842c151edd Replaced _systime with clock_gettime.
We want to add the capability to not only get the time but also set the time, but there's no "setter" for the "getter" time().

The first ones that come into mind are gettimeofday() and settimeofday(). However, they take a struct timezone argument that doesn't make sense - even the man pages says "The use of the timezone structure is obsolete; the tz argument should normally be specified as NULL." And POSIX says "Applications should use the clock_gettime() function instead of the obsolescent gettimeofday() function."

The ...timeofday() functions work with microseconds while the clock_...time() functions work with nanoseconds. Given that we expect our targets to support only 1/10 of seconds the microseconds look preferable at first sight. However, already microseconds require the cc65 data type 'long' so it's not such a relevant difference to nanoseconds. Additionally clock_getres() seems useful.

In order to avoid code duplication clock_gettime() takes over the role of the actual time getter from _systime(). So time() now calls clock_gettime() instead of _systime().

For some reason beyond my understanding _systime() was mentioned in time.h. _systime() worked exactly like e.g. _sysremove() and those _sys...() functions are all considered internal. The only reason I could see would be a performance gain of bypassing the time() wrapper. However, all known _systime() implementations internally called mktime(). And mktime() is implemented in C using an iterative algorithm so I really can't see what would be left to gain here. From that perspective I decided to just remove _systime().
2018-08-15 16:06:44 +02:00
Olli Savia
635a99c083 TAB to space conversion 2018-06-30 16:25:43 +03:00
Olli Savia
96e6a0a114 Common include file is now cbm_kernal.inc 2018-06-29 22:58:16 +03:00
Olli Savia
f7fbac4c6b Use common include file cbmkernal.inc 2018-06-27 21:39:24 +03:00
IrgendwerA8
30a679ba36 Saved 3 bytes for the C16 target. 2018-05-26 20:30:38 +02:00
Marco van den Heuvel
8424286a3e Add c16 files as well. 2018-03-23 14:31:53 -07:00
Christian Groessler
bba7c980e4 libsrc/c16/get_tv.s: remove code duplication
Use the plus4 version of get_tv.s.
2017-01-26 16:43:47 +01:00
Oliver Schmidt
13482984ca Introduced internal gotoxy that pops both parameters.
About all CONIO functions offering a <...>xy variant call
  popa
  _gotoxy

By providing an internal gotoxy variant that starts with a popa all those CONIO function can be shortened by 3 bytes. As soon as program calls more than one CONIO function this means an overall code size reduction.
2016-06-05 14:58:38 +02:00
Oliver Schmidt
a2c9cb021a Moved things into ONCE.
Code and or data used only during initialization belongs into the ONCE segment.
2016-03-15 22:55:36 +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
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
031bd2ebf0 Fixed the random-seed generators for the Commodore targets.
They use a byte from the time counter; but, it is stored in big-endian order.
2015-09-11 10:03:07 -04:00
Greg King
c7969a78b0 Refined the comments in the target start-up files.
Fixed typo errors.  Made the comments consistent across all those files.
2014-08-24 10:10:20 -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
Oliver Schmidt
2c975d3642 Create static drivers directly from source files.
Up to now static drivers were created via co65 from dynamic drivers. However there was an issue with that approach:

The dynamic drivers are "o65 simple files" which obligates that they start with the 'code' segment. However dynamic drivers need to start with the module header - which is written to. For dynamic drivers this isn't more than a conceptual issue because they are always contain a 'data' segment and may therefore only be loaded into writable memory.

However when dynamic drivers are converted to static drivers using co65 then that issue becomes a real problem as then the 'code' segment may end up in non-writable memory - and thus writing to the module header fails.

Instead of changing the way dynamic drivers work I opted to rather make static driver creation totally independent from dynamic drivers. This allows to place the module header in the 'data' segment (see 'module.mac').
2014-06-04 23:50:18 +02:00
Oliver Schmidt
d6c3bd29ac Renamed JUMPTABLE and cleaned up module.cfg.
This change was suppsed to fix the issue that the former JUMPTABLE is merked as 'ro' while it is actually written to in several scenarios. When drivers are converted using co65 and then compiled into ROMs the JUMPTABLE isn't copied to RAM and therefore the write operations in question fail.

However unfortunately I didn't succeed in changing that :-( Just setting the former JUMPTABLE to 'rw' broke the drivers. So I placed the DATA segment directly after the former JUMPTABLE segment. This made the drivers converted with co65 work again - obviously after changing libsrc/Makefile:235 from '--code-label' to '--data-label'. But the actual dynamic drivers still didn't work as the former JUMPTABLE wasn't placed as the beginning of the loaded file anymore. That effect could be changed by exchanging src/ld65/o65.c:1391 with src/ld65/o65.c:1394 but doing so broke the drivers again :-((
2014-05-01 21:44:39 +02:00
Oliver Schmidt
23650cb946 Added library reference joy_libref to JOY interface. 2013-06-01 00:36:08 +02:00
Oliver Schmidt
619b215260 Added library reference em_libref to EMD interface.
Occasionally dynamically drivers suffer from not being to refer to
content in the C library. Therefore I added a mechanism to allow
a C library for a certian target to define a symbol that will be
handed over to dynamic drivers for that target. Then the drivers
can use their refernce to that symbol to access content in the C
library.
2013-06-01 00:11:31 +02:00
Oliver Schmidt
85885001b1 Removed (pretty inconsistently used) tab chars from source code base. 2013-05-09 13:57:12 +02:00
Oliver Schmidt
81e467cdc2 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:15:30 +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
ol.sc
2e5823d43d Save some bytes by sharing the code doing the actual vector setting. Note: Jumping from segemnt INIT to segment CODE is okay while the other way wouldn't be.
git-svn-id: svn://svn.cc65.org/cc65/trunk@5989 b7a2c559-68d2-44c3-8de9-860c34a00d81
2013-02-14 16:48:05 +00:00
ol.sc
9547f6f584 Fixed copy&paste bug.
git-svn-id: svn://svn.cc65.org/cc65/trunk@5987 b7a2c559-68d2-44c3-8de9-860c34a00d81
2013-02-13 07:48:37 +00:00
ol.sc
7c9171ee87 Moved IRQ hooking / unhooking from startup code to constructor / destructor to avoid linking in the hooking / unhooking code (and callirq) for the majority of cc65 prorams not linking in interruptors.
git-svn-id: svn://svn.cc65.org/cc65/trunk@5985 b7a2c559-68d2-44c3-8de9-860c34a00d81
2013-02-12 22:39:38 +00:00
ol.sc
6860ac7dfd Introduced static standard drivers.
git-svn-id: svn://svn.cc65.org/cc65/trunk@5891 b7a2c559-68d2-44c3-8de9-860c34a00d81
2012-11-01 19:53:47 +00:00
ol.sc
1bba8355da Fixed typo.
git-svn-id: svn://svn.cc65.org/cc65/trunk@5889 b7a2c559-68d2-44c3-8de9-860c34a00d81
2012-10-31 23:39:58 +00:00
ol.sc
a3c940e315 Convert dynamically loadable drivers into statically linkable drivers and add them to the target libraries.
git-svn-id: svn://svn.cc65.org/cc65/trunk@5887 b7a2c559-68d2-44c3-8de9-860c34a00d81
2012-10-29 20:26:26 +00:00
uz
9324904535 Reverted r5835 because of Olivers changes to the asm includes.
git-svn-id: svn://svn.cc65.org/cc65/trunk@5838 b7a2c559-68d2-44c3-8de9-860c34a00d81
2012-10-02 18:15:39 +00:00
uz
d10c8cd5fc ST is already imported in plus4.inc, no need to import it separately.
git-svn-id: svn://svn.cc65.org/cc65/trunk@5835 b7a2c559-68d2-44c3-8de9-860c34a00d81
2012-10-01 09:29:23 +00:00
ol.sc
59e96ef740 Turned the 'ST' status byte into a symbol resolved by the linker in order to allow to use it from code living in the 'cbm' directory.
Moved getdevice.s from 'c64'/'c128' to 'cbm' making use of the new 'ST' setup.

git-svn-id: svn://svn.cc65.org/cc65/trunk@5834 b7a2c559-68d2-44c3-8de9-860c34a00d81
2012-09-30 18:20:15 +00:00
uz
5b659547b8 Removed the jump to RESTOR on exit for all the CBM platforms.
git-svn-id: svn://svn.cc65.org/cc65/trunk@5355 b7a2c559-68d2-44c3-8de9-860c34a00d81
2012-01-01 19:58:31 +00:00
uz
da59130820 Changed the startup module and the linker config for the C16 to use the common
loadaddr and exehdr modules.


git-svn-id: svn://svn.cc65.org/cc65/trunk@4871 b7a2c559-68d2-44c3-8de9-860c34a00d81
2010-11-17 12:46:55 +00:00
uz
fa1b5047dd Fixed order of options in call to ld65, which became important after the
latest changes.


git-svn-id: svn://svn.cc65.org/cc65/trunk@4843 b7a2c559-68d2-44c3-8de9-860c34a00d81
2010-11-09 21:33:14 +00:00
ol.sc
d1aad57b98 Initialize _curunit from the zeropage value DEVNUM (aka First Address) in a constructor with a very high priority to be called before DEVNUM gets overwritten by other constructors.
git-svn-id: svn://svn.cc65.org/cc65/trunk@4588 b7a2c559-68d2-44c3-8de9-860c34a00d81
2010-02-14 23:12:54 +00:00
uz
7e2a24176f Replaced $30 by literal '0' for better readability.
git-svn-id: svn://svn.cc65.org/cc65/trunk@4513 b7a2c559-68d2-44c3-8de9-860c34a00d81
2009-12-10 22:12:24 +00:00
uz
13698871cb Removed the call to CLRCH in the startup code.
git-svn-id: svn://svn.cc65.org/cc65/trunk@4512 b7a2c559-68d2-44c3-8de9-860c34a00d81
2009-12-10 21:22:17 +00:00
uz
60bc009991 * Moved the BASIC stub that calls the compiled program into it's own segment
named EXEHDR.
* Renamed BASICHDR to EXEHDR for the PET-II machines.
* Moved the call to CHRCH in front of the code that saves the zero page, since
  open files are sometimes remembered in the zero page, so we need to close
  them before we grab a copy.


git-svn-id: svn://svn.cc65.org/cc65/trunk@4507 b7a2c559-68d2-44c3-8de9-860c34a00d81
2009-12-09 12:42:24 +00:00
uz
bfbf94404b Squeezed bytes and cycles out of the kbhit functions for almost all platforms.
git-svn-id: svn://svn.cc65.org/cc65/trunk@4480 b7a2c559-68d2-44c3-8de9-860c34a00d81
2009-11-24 18:31:16 +00:00
uz
c7a33334ba Don't hardcode the address of the SYS call for the startup code of the
Commodore machines.


git-svn-id: svn://svn.cc65.org/cc65/trunk@4474 b7a2c559-68d2-44c3-8de9-860c34a00d81
2009-11-23 12:01:24 +00:00
uz
5c5d01d84a Moved most platform assembler includes into asminc, so they will be available
in the distribution. 
Added --forget-inc-paths to the command line of the assembler in the
Makefiles, because the assembler does now have builtin paths and will find
include files from an installation first.
Hopefully fixed any problems that arose from the two changes.


git-svn-id: svn://svn.cc65.org/cc65/trunk@4223 b7a2c559-68d2-44c3-8de9-860c34a00d81
2009-09-24 17:44:22 +00:00
uz
8216bf1d6a Force an import of the special symbol __STARTUP__ in the C compiler when
main() is encountered. Define this symbol in the startup code. This will
automatically force linking of the startup code which can then reside inside
the standard library as any other object file.


git-svn-id: svn://svn.cc65.org/cc65/trunk@3988 b7a2c559-68d2-44c3-8de9-860c34a00d81
2009-07-31 12:05:42 +00:00
uz
931add050e Added a systime implementation by Stefan Haubenthal with a few changes. The
routine reads the TOD clock of CIA1 on the C64 and C128. Since systime was a
dummy routine common for all CBMs before, this change adds an individual dummy
routine for all other CBM systems. CBM510/610 do also have a TOD clock, so a
similar function as in the C64 could be used ...


git-svn-id: svn://svn.cc65.org/cc65/trunk@3974 b7a2c559-68d2-44c3-8de9-860c34a00d81
2009-07-27 18:44:37 +00:00
uz
81c7457e04 Added support for chained interrupt handlers installed with .condes type 2.
git-svn-id: svn://svn.cc65.org/cc65/trunk@3953 b7a2c559-68d2-44c3-8de9-860c34a00d81
2009-02-22 18:16:13 +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
f257b2ee81 Moved the data that keeps a copy of the used zero page locations in its own
segment to reduce the executable size.


git-svn-id: svn://svn.cc65.org/cc65/trunk@3849 b7a2c559-68d2-44c3-8de9-860c34a00d81
2008-07-03 19:39:14 +00:00
cuz
d0bee35728 Move constructor code into the INIT segment
git-svn-id: svn://svn.cc65.org/cc65/trunk@3405 b7a2c559-68d2-44c3-8de9-860c34a00d81
2005-02-26 09:28:46 +00:00
cuz
303304fe90 Add definitions for tools so the makefile is useful by itself.
git-svn-id: svn://svn.cc65.org/cc65/trunk@3262 b7a2c559-68d2-44c3-8de9-860c34a00d81
2004-10-26 19:28:26 +00:00