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

2769 Commits

Author SHA1 Message Date
Patrick Pelletier
411a5a9483 Don't pass mode argument to open() from _fopen().
It isn't necessary, since paravirt.c has a default if the mode isn't
pushed onto the stack.
2018-08-17 23:28:45 +02:00
Patrick Pelletier
aba320eade Allow "mode" argument to open() to be passed from 6502 code.
Implements this suggestion:
https://github.com/cc65/cc65/pull/719#issuecomment-413809096
2018-08-17 23:28:45 +02:00
Oliver Schmidt
f40dcb5883 Added clock_getres() / clock_settime() for the Apple II.
The situation on the Apple II is rather special: There are several types of RTCs. It's not desirable to have specific code for all of them. As the OS supports file timestamps RTC owners usually use OS drivers for their RTC. Those drivers read the RTC and write the result in a "date/time location" in RAM. The OS reads the date/time from the RAM location. If there's no RTC the RAM location keeps containing zeros. The OS uses those zeros as timestamps and the files show up in a directory as "<NO DATE>".

There's no common interface to set RTCs so if an RTC _IS_ present there's just nothing to do. However, if there's _NO_ RTC present the user might very well be interest to "manually" set the RAM location in order to have timestamps. But he surely doesn't want to manually set the RAM location over an over again. Rather he wants to set it just once after booting the OS.

From that perspective it makes most sense to not set both the date and the time but rather only set the date and have the time just stay zero. Then files show up in a directory as "DD-MON-YY  0:00".

So clock_settime() checks if the current time equals 0:00. If it does _NOT_ then an RTC is supposed to be active and clock_settime() fails with ERANGE. Otherwise clock_settime() ignores sets the date - and completely ignores the time provided as parameter.

clock_getres() too checks if the current time equals 0:00. If it does _NOT_ then an RTC is supposed to be active and clock_getres() returns a time resolution of one minute. Otherwise clock_getres() presumes that the only one who sets the RAM location is clock_settime() and therefore returns a time resolution of one day.
2018-08-15 21:34:35 +02:00
Oliver Schmidt
326ca263c9 Minor style fix. 2018-08-15 19:40:56 +02:00
Oliver Schmidt
59a8149556 Added clock_getres() for CBMs.
All CBMs have a clock (CIA TOD) resolution of 1/10 second.
2018-08-15 19:40:27 +02: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
Oliver Schmidt
55a07c1dcd Removed stray /t char. 2018-08-15 16:06:44 +02:00
Oliver Schmidt
bbed9fdb63 Fixed typo. 2018-08-15 16:06:44 +02:00
Oliver Schmidt
a9ce4dc76c "Inverted" time_t value handling.
So far time_t values were interpreted as local time values. However, usually time_t values are to be interpreted as "seconds since 1 Jan 1970 in UTC". Therefore all logic handling time_t values has to be changed.

- So far gmtime() called localtime() with an adjusted time_t, now localtime() calls gmtime() with an adjusted time_t.
- mktime() has to do "the opposite" of localtime(), to keep it that way mktime() does now the inverse adjustment made by localtime().
- All currently present time() implementations internally call mktime() so they don't require individual adjustments.
2018-08-02 17:12:12 +02:00
Greg King
e6fc904e3c Fixed some code, to adapt to register-use changes caused by pull request #652. 2018-07-27 09:21:31 -04:00
Oliver Schmidt
e86a7db18b Some minor cleanups. 2018-07-26 14:35:26 +02:00
Oliver Schmidt
e949a3e642 Fixed regression introduced by https://github.com/cc65/cc65/pull/652. 2018-07-26 14:31:17 +02:00
IrgendwerA8
c9869c1a26 Quick fix for missing _div() adaptation after 95223be. 2018-07-26 10:44:22 +02:00
Olli Savia
fdce8fb34d Added a blank line between .include statements and .import/.export statements 2018-07-04 17:40:28 +03:00
Olli Savia
f7636fe8f2 Removed .import for std kernal entries. Added .include "cbm.inc" 2018-07-03 22:47:42 +03:00
Olli Savia
032a3877e0 Added .import for std kernal entries 2018-07-03 22:44:59 +03:00
Olli Savia
3e94f7f55c Moved C128 specific definitions to cbm_kernal.inc 2018-07-01 09:58:39 +03:00
Olli Savia
820c0efcb3 Use common include file cbm_kernal.inc 2018-07-01 09:56:37 +03:00
Olli Savia
4c45de2c45 Updated comment 2018-07-01 09:54:39 +03:00
Olli Savia
635a99c083 TAB to space conversion 2018-06-30 16:25:43 +03:00
Olli Savia
d5bc751f54 Removed RAMTAS 2018-06-29 22:59:53 +03:00
Olli Savia
96e6a0a114 Common include file is now cbm_kernal.inc 2018-06-29 22:58:16 +03:00
Olli Savia
42e9b971c5 Merge remote-tracking branch 'upstream/master' into cbmkernal_stage2 2018-06-29 22:50:02 +03:00
Olli Savia
f7fbac4c6b Use common include file cbmkernal.inc 2018-06-27 21:39:24 +03:00
Oliver Schmidt
86945a1270
Merge pull request #687 from polluks/patch-12
Smaller driver code
2018-06-21 22:37:29 +02:00
Stefan
6a70d1dab1
Removed unused label 2018-06-21 20:30:14 +00:00
greg-king5
4980fade74
Made LINE plot single-point lines correctly. 2018-06-21 08:18:53 -04:00
Stefan
23534beaa6
Smaller driver code 2018-06-21 00:25:33 +00:00
Fabrizio Caruso
9af2d6b4a1 spaces instead of tab 2018-06-06 21:18:47 +02:00
Fabrizio Caruso
e626180b28 Fix joystick for the Supervision target 2018-06-06 21:11:17 +02:00
Greg King
6d87370881 Fixed strpbrk().
Added its prototype.  Documented it.
2018-05-29 14:29:50 -04:00
IrgendwerA8
465a651090 Free 2 bytes again. 2018-05-29 01:51:24 +02:00
IrgendwerA8
f55b564ca1 Save the three bytes for the plus4 too. 2018-05-27 00:10:58 +02:00
IrgendwerA8
30a679ba36 Saved 3 bytes for the C16 target. 2018-05-26 20:30:38 +02:00
IrgendwerA8
49a9b88734 Saved even one more byte. 2018-05-26 19:53:44 +02:00
IrgendwerA8
e77ac8a230 1 byte donation for Fabrizio ;) 2018-05-26 16:37:03 +02:00
Oliver Schmidt
95223be101
Merge pull request #663 from IrgendwerA8/more_popptr1_adaptations
Adapted div & mod for popptr1.
2018-05-26 13:01:27 +02:00
IrgendwerA8
8a5d1b9674 Reestablished entry state of signed operation and optimized that (again). 2018-05-25 23:52:42 +02:00
IrgendwerA8
ba5b580368 Fixed first letter of comments (should be upper case). 2018-05-25 16:10:16 +02:00
Oliver Schmidt
0b323f717b
Update symbols.txt 2018-05-25 14:48:20 +02:00
Oliver Schmidt
0138e110cc
Merge pull request #662 from Compyx/master
Add CBM kernal call SECOND to CBM library (see issue #525)
2018-05-25 14:00:36 +02:00
IrgendwerA8
71420223bc Changed the name of the file too. 2018-05-24 11:37:17 +02:00
IrgendwerA8
9c1cb0801c Changed naming absvaludiv -> absvaludiv16. 2018-05-24 11:31:43 +02:00
IrgendwerA8
dd411efd1c Adapted div & mod for popptr1. 2018-05-24 03:55:40 +02:00
compyx
8ffe623e74 Add CBM kernal call SECOND to CBM library (see issue #525) 2018-05-23 17:32:02 +02:00
Oliver Schmidt
9246b14f68
Merge pull request #658 from polluks/patch-9
Indicate a dummy outtext & some clean-up
2018-05-23 17:05:12 +02:00
Oliver Schmidt
746e3d1454
Merge pull request #656 from Compyx/master
Add CBM kernal call TKSA to CBM library (see issue #525)
2018-05-23 09:47:41 +02:00
Oliver Schmidt
f485be1b84
Merge pull request #657 from IrgendwerA8/VariousSpeedSizeOptimizations
Various speed size optimizations
2018-05-23 09:46:30 +02:00
Stefan
a4c06f2572
Clean-up because of tgidrv_line.inc 2018-05-22 22:32:50 +00:00
Stefan
b945beb6a7
Indicate a dummy outtext 2018-05-22 21:18:10 +00:00