]> git.sur5r.net Git - cc65/log
cc65
6 years agoFormatting fixes.
laubzega [Sun, 30 Sep 2018 21:22:23 +0000 (14:22 -0700)]
Formatting fixes.

6 years agoFix non-goto jumps (i.e. inline assembly).
laubzega [Sat, 29 Sep 2018 19:06:33 +0000 (12:06 -0700)]
Fix non-goto jumps (i.e. inline assembly).

6 years agoAnother warning.
laubzega [Sat, 29 Sep 2018 05:25:22 +0000 (22:25 -0700)]
Another warning.

6 years agoFix a warning.
laubzega [Sat, 29 Sep 2018 05:17:49 +0000 (22:17 -0700)]
Fix a warning.

6 years agoProper warnings for "risky" gotos.
laubzega [Sat, 29 Sep 2018 05:11:09 +0000 (22:11 -0700)]
Proper warnings for "risky" gotos.

6 years agoClean-up
laubzega [Wed, 26 Sep 2018 07:11:40 +0000 (00:11 -0700)]
Clean-up

6 years agoAdded testcase for between-blocks gotos.
laubzega [Wed, 26 Sep 2018 06:54:45 +0000 (23:54 -0700)]
Added testcase for between-blocks gotos.
Deleted old testcase.

6 years agoAdjust SP on gotos between blocks with local variables.
laubzega [Tue, 25 Sep 2018 07:56:08 +0000 (00:56 -0700)]
Adjust SP on gotos between blocks with local variables.

6 years agoSwitched from warning to error. Tightened the testcase.
laubzega [Sun, 23 Sep 2018 23:22:59 +0000 (16:22 -0700)]
Switched from warning to error. Tightened the testcase.

6 years agoMissed the comment.
Laubzega [Sat, 22 Sep 2018 05:25:05 +0000 (22:25 -0700)]
Missed the comment.

6 years agoAdd a testcase for https://github.com/cc65/cc65/pull/757
Laubzega [Sat, 22 Sep 2018 05:23:21 +0000 (22:23 -0700)]
Add a testcase for https://github.com/cc65/cc65/pull/757

6 years agoMinor changes after review.
Laubzega [Sat, 22 Sep 2018 04:10:58 +0000 (21:10 -0700)]
Minor changes after review.

6 years agoFix for variableless main().
Laubzega [Fri, 21 Sep 2018 08:17:29 +0000 (01:17 -0700)]
Fix for variableless main().

6 years agoAdd checks for risky goto statements.
Laubzega [Fri, 21 Sep 2018 07:40:05 +0000 (00:40 -0700)]
Add checks for risky goto statements.

6 years agoAtari: implement clock_getres()
Christian Groessler [Thu, 27 Sep 2018 18:22:21 +0000 (20:22 +0200)]
Atari: implement clock_getres()

6 years agoAtari: add support for BW-DOS. Initially contributed by Daniel Serpell.
Christian Groessler [Thu, 27 Sep 2018 15:37:59 +0000 (17:37 +0200)]
Atari: add support for BW-DOS. Initially contributed by Daniel Serpell.

6 years agoclock-test.c: remove "static" optimization
Christian Groessler [Tue, 25 Sep 2018 18:26:25 +0000 (20:26 +0200)]
clock-test.c: remove "static" optimization

6 years agoclock-test.c: do doesclrscrafterexit() handling the canonical way.
Christian Groessler [Tue, 25 Sep 2018 12:35:52 +0000 (14:35 +0200)]
clock-test.c: do doesclrscrafterexit() handling the canonical way.

6 years agoasminc/atari.inc: remove TABs which slipped in
Christian Groessler [Tue, 25 Sep 2018 01:05:30 +0000 (03:05 +0200)]
asminc/atari.inc: remove TABs which slipped in

6 years agoAdd testcode/lib/clock-test.c.
Christian Groessler [Tue, 25 Sep 2018 00:47:45 +0000 (02:47 +0200)]
Add testcode/lib/clock-test.c.

A test program for the "clock" functions.

6 years agoAtari: clock_gettime() and clock_settime() implementations
Christian Groessler [Tue, 25 Sep 2018 00:42:45 +0000 (02:42 +0200)]
Atari: clock_gettime() and clock_settime() implementations

They are using SpartaDOS-X interfaces and are therefore only working
in this environment.

6 years agoasminc/atari.inc: add some SpartaDOS-X defines
Christian Groessler [Tue, 25 Sep 2018 00:31:49 +0000 (02:31 +0200)]
asminc/atari.inc: add some SpartaDOS-X defines

6 years agolibsrc/atari/getdefdev.s: small comment change
Christian Groessler [Thu, 20 Sep 2018 21:58:23 +0000 (23:58 +0200)]
libsrc/atari/getdefdev.s: small comment change

6 years agoAdjusted URL to use https (and removed obsolete dates).
Oliver Schmidt [Thu, 20 Sep 2018 10:42:15 +0000 (12:42 +0200)]
Adjusted URL to use https (and removed obsolete dates).

6 years agoSwitch to https links.
Oliver Schmidt [Thu, 20 Sep 2018 10:21:58 +0000 (12:21 +0200)]
Switch to https links.

Most targets redirected to https anyway.

6 years agoThe doc now lives in the 'master' branch of the 'doc' project.
Oliver Schmidt [Tue, 18 Sep 2018 21:37:25 +0000 (23:37 +0200)]
The doc now lives in the 'master' branch of the 'doc' project.

6 years agolibsrc/atari/getdefdev.s: small optimization and fix a typo
Christian Groessler [Fri, 14 Sep 2018 14:54:20 +0000 (16:54 +0200)]
libsrc/atari/getdefdev.s: small optimization and fix a typo

6 years agoMerge pull request #740 from laubzega/master
greg-king5 [Fri, 14 Sep 2018 04:59:47 +0000 (00:59 -0400)]
Merge pull request #740 from laubzega/master

Add segment type "overwrite".

6 years agoAtari: Make a good "default device" on AtariDOS (2.0 and 2.5) and MyDOS.
Christian Groessler [Thu, 13 Sep 2018 20:33:54 +0000 (22:33 +0200)]
Atari: Make a good "default device" on AtariDOS (2.0 and 2.5) and MyDOS.

The default device will be the one the program was loaded from instead of
always D1:.

6 years agoFixed reference link. 740/head
Laubzega [Thu, 13 Sep 2018 06:51:38 +0000 (23:51 -0700)]
Fixed reference link.

6 years agoSlight fixes to the documentation.
Laubzega [Wed, 12 Sep 2018 05:14:45 +0000 (22:14 -0700)]
Slight fixes to the documentation.

6 years agofix comment in last change
Christian Groessler [Tue, 11 Sep 2018 23:20:12 +0000 (01:20 +0200)]
fix comment in last change

6 years agoatarixl: check at startup whether RAM beneath the ROM is in use
Christian Groessler [Tue, 11 Sep 2018 23:05:52 +0000 (01:05 +0200)]
atarixl: check at startup whether RAM beneath the ROM is in use

If detected, the program refuses to run, preventing a crash.
The check only works with SpartaDOS. I don't have an overview which
DOSes potentially use the RAM under the ROM. Or which other installed
programs might use it.

No additional runtime memory space is consumed, since the change
is in the "system check" load chunk which gets replaced by the
user program during loading.

6 years agoFirst cut of "overwrite" segment docs.
Laubzega [Sun, 9 Sep 2018 02:20:01 +0000 (19:20 -0700)]
First cut of "overwrite" segment docs.

6 years agoNew segment type renamed to "overwrite".
Laubzega [Sun, 9 Sep 2018 02:18:41 +0000 (19:18 -0700)]
New segment type renamed to "overwrite".

6 years agoAdded hint random number generator hint.
Oliver Schmidt [Sat, 8 Sep 2018 21:59:39 +0000 (23:59 +0200)]
Added hint random number generator hint.

6 years agoProtect random counter against ProDOS.
Oliver Schmidt [Sat, 8 Sep 2018 21:29:59 +0000 (23:29 +0200)]
Protect random counter against ProDOS.

Although documented nowhere (!!!) ProDOS trashes the random counter locations $4E/$4F. Is discovered this because my TCP connections didn't have random local ports.

It's a really funny coincidence that David Finnigan discovered only 3 years ago the very same issue because of the very same reason: https://groups.google.com/forum/#!topic/comp.sys.apple2.programmer/1ciep_Oetvo

6 years agoJust removed some trailing spaces.
Oliver Schmidt [Sat, 8 Sep 2018 21:14:54 +0000 (23:14 +0200)]
Just removed some trailing spaces.

6 years agoSupport randomize().
Oliver Schmidt [Sat, 8 Sep 2018 16:44:30 +0000 (18:44 +0200)]
Support randomize().

In order to have randomize() work as expected (and the Apple II random number generation in general) it is necessary to update the random counter during keypress wait just like the ROM function does.

6 years agoAtari: RealDOS adaptations
Christian Groessler [Thu, 6 Sep 2018 13:55:07 +0000 (15:55 +0200)]
Atari: RealDOS adaptations

RealDOS is a SpartaDOS clone. Handle it the same way as SpartaDOS.

6 years agoAtari: Add detection of RealDOS (http://www.realdos.net/realdos.html).
Christian Groessler [Wed, 5 Sep 2018 23:10:47 +0000 (01:10 +0200)]
Atari: Add detection of RealDOS (http://www.realdos.net/realdos.html).

6 years agoRename more stuff from "overlay" to "replace".
Laubzega [Thu, 6 Sep 2018 07:18:39 +0000 (00:18 -0700)]
Rename more stuff from "overlay" to "replace".

6 years agoAtari: atarixl config files already had a LOWBSS segment.
Christian Groessler [Tue, 4 Sep 2018 09:44:04 +0000 (11:44 +0200)]
Atari: atarixl config files already had a LOWBSS segment.

6 years agoAtari: atari-cart.cfg: There's a simpler way to discard the contents of the LOWBSS...
Christian Groessler [Tue, 4 Sep 2018 09:32:40 +0000 (11:32 +0200)]
Atari: atari-cart.cfg: There's a simpler way to discard the contents of the LOWBSS segment.

Thanks to Greg King for the hint.

6 years agoAtari: fix interrupt handling if extended memory is banked in
Christian Groessler [Sun, 2 Sep 2018 21:07:03 +0000 (23:07 +0200)]
Atari: fix interrupt handling if extended memory is banked in

Extendend memory is mapped over the main memory in the 0x4000..0x7FFF
area. Many DOSes disable interrupts while extended memory is banked in,
but not all (e.g. SpartaDOS-X).
This change modifies the initial interrupt handler to map in main memory
before chaining to the "worker" handlers.
Since the initial interrupt handler uses a data segment to store the
trampoline to chain to the original handler, introduce a new "LOWBSS"
segment to hold this trampoline. Otherwise the trampoline may end up
inside the 0x4000..0x7FFF area.

Add a link time warning if "LOWCODE" segment lays within the extended
memory window.

6 years agoAtari, Atari5200: disable "attract mode" on mouse or joystick input
Christian Groessler [Tue, 4 Sep 2018 21:08:38 +0000 (23:08 +0200)]
Atari, Atari5200: disable "attract mode" on mouse or joystick input

Fixes #736.

6 years agoSegment OVERLAY renamed to REPLACE. Bugfix for read-only segments. Formatting.
Laubzega [Tue, 4 Sep 2018 07:34:28 +0000 (00:34 -0700)]
Segment OVERLAY renamed to REPLACE. Bugfix for read-only segments. Formatting.

6 years agoJust a minor comment improvement.
Oliver Schmidt [Sun, 2 Sep 2018 21:06:27 +0000 (23:06 +0200)]
Just a minor comment improvement.

6 years agoFixed bugs; and, improved the efficiency of some pce library functions.
Greg King [Thu, 26 Nov 2015 20:06:20 +0000 (15:06 -0500)]
Fixed bugs; and, improved the efficiency of some pce library functions.

6 years agoFixed and improved some pce comments.
Greg King [Tue, 17 Nov 2015 14:14:15 +0000 (09:14 -0500)]
Fixed and improved some pce comments.

6 years agoFixed some mistakes (mostly in the documentation).
Greg King [Fri, 2 Oct 2015 17:28:17 +0000 (13:28 -0400)]
Fixed some mistakes (mostly in the documentation).

6 years agoStyle changes.
Greg King [Fri, 2 Oct 2015 14:50:22 +0000 (10:50 -0400)]
Style changes.

6 years agoUsed I/O mirror locations that avoid (redirected) zero-page accesses.
Greg King [Tue, 29 Sep 2015 16:39:58 +0000 (12:39 -0400)]
Used I/O mirror locations that avoid (redirected) zero-page accesses.

6 years agoDocument style clean-up.
Greg King [Wed, 29 Aug 2018 19:43:20 +0000 (15:43 -0400)]
Document style clean-up.

6 years agoMoved the NES font into its own object module.
Greg King [Wed, 29 Aug 2018 16:13:58 +0000 (12:13 -0400)]
Moved the NES font into its own object module.

It can be replaced by a custom font when a program is built.

6 years agoMerge pull request #706 from xlar54/master
greg-king5 [Wed, 29 Aug 2018 14:34:05 +0000 (10:34 -0400)]
Merge pull request #706 from xlar54/master

* tgi driver for c128 VIC-II

* Made the VIC-IIe TGI driver put its bitmap behind the ROMs.

* c128-hi.tgi doc

6 years agoFix for multiple overlay segments.
Laubzega [Sun, 26 Aug 2018 03:21:12 +0000 (20:21 -0700)]
Fix for multiple overlay segments.

6 years agoAdd segment type "overlay". 739/head
Laubzega [Sat, 25 Aug 2018 17:18:23 +0000 (10:18 -0700)]
Add segment type "overlay".

6 years agoAtari5200 joystick driver: enable POT input.
Christian Groessler [Fri, 24 Aug 2018 15:04:31 +0000 (17:04 +0200)]
Atari5200 joystick driver: enable POT input.

The "Atari800" emulator doesn't emulate this aspect, therefore the problem
wasn't noticed before.

6 years agoMade cc65's "Illegal escaped character" diagnostic show which code was escaped.
Greg King [Tue, 21 Aug 2018 12:55:49 +0000 (08:55 -0400)]
Made cc65's "Illegal escaped character" diagnostic show which code was escaped.

6 years agoUpdate crt0.s
Stefan [Tue, 21 Aug 2018 07:06:59 +0000 (09:06 +0200)]
Update crt0.s

6 years agoCMOS optimisation 3rd
Stefan [Mon, 20 Aug 2018 21:56:16 +0000 (21:56 +0000)]
CMOS optimisation 3rd

"The decimal flag D is cleared" [...]
http://shu.emuunlim.com/download/pcedocs/pce_cpu.html

6 years agoRemoved the compiler's recovery code for illegal escaped characters.
Greg King [Mon, 20 Aug 2018 21:51:22 +0000 (17:51 -0400)]
Removed the compiler's recovery code for illegal escaped characters.

It caused the error cascade that it was supposed to prevent.

6 years agoUpdate irq.s
Stefan [Mon, 20 Aug 2018 14:55:36 +0000 (16:55 +0200)]
Update irq.s

6 years agoCMOS optimisation
Stefan [Mon, 20 Aug 2018 14:45:52 +0000 (16:45 +0200)]
CMOS optimisation

The Lynx CPU always cleared the flag.

6 years agoseek test: Test some additional error cases.
Patrick Pelletier [Mon, 20 Aug 2018 17:53:35 +0000 (10:53 -0700)]
seek test: Test some additional error cases.

6 years agoseek test: remove trailing newline from filename
Patrick Pelletier [Mon, 20 Aug 2018 17:10:10 +0000 (10:10 -0700)]
seek test: remove trailing newline from filename

Looks like no one ever tried this?  fopen was returning EINVAL because
fgets was leaving a trailing newline at the end of the filename.
(Which is what fgets is documented to do.)

6 years agolseek: Return EINVAL if new position is less than 0 or greater than 2^24 - 1.
Patrick Pelletier [Mon, 20 Aug 2018 15:45:40 +0000 (08:45 -0700)]
lseek: Return EINVAL if new position is less than 0 or greater than 2^24 - 1.

Also, implemented @greg-king5's suggestion to save a byte on error paths.

6 years agolseek: Implement additional feedback from PR #723.
Patrick Pelletier [Mon, 20 Aug 2018 07:56:01 +0000 (00:56 -0700)]
lseek: Implement additional feedback from PR #723.

* Check CPU_ISET_65SC02 rather than APPLE2ENH.
* Set sreg and sreg+1 to $FF on error, to return -1 as a long.

6 years agolseek: use STZ for APPLE2ENH
Patrick Pelletier [Mon, 20 Aug 2018 07:10:51 +0000 (00:10 -0700)]
lseek: use STZ for APPLE2ENH

(As suggested in pull request.)

6 years agoFix ftell() on Apple II to return the correct value.
Patrick Pelletier [Sun, 19 Aug 2018 23:04:42 +0000 (16:04 -0700)]
Fix ftell() on Apple II to return the correct value.

Fixes this issue:
https://github.com/cc65/cc65/issues/722

ftell() returns the value returned by lseek(), and lseek() for the
Apple II wasn't returning a value.

6 years agoAdded more source-code improvements to the conio test program.
Greg King [Mon, 20 Aug 2018 18:42:41 +0000 (14:42 -0400)]
Added more source-code improvements to the conio test program.

Also, made the f6/f5 function keys change the border color instead of the background color.

6 years agoImproved CONIO test in several ways.
Oliver Schmidt [Sun, 19 Aug 2018 22:29:29 +0000 (00:29 +0200)]
Improved CONIO test in several ways.

- Use more consistent source code style.
- Don't presume that CH_F... constants are present.
- Allow to quit the program via 'Enter'.

6 years agoImplemented line wrap.
Oliver Schmidt [Sun, 19 Aug 2018 22:22:45 +0000 (00:22 +0200)]
Implemented line wrap.

According to https://github.com/cc65/wiki/wiki/Direct-console-IO it is undefined what happens when the end of the sceen is reached. But it is _not_ undefined what happens when the end of the line is reached. So implement the usual thing - which was easy enough to do after all.

6 years agoMade Apple II CONIO more flexible.
Oliver Schmidt [Sun, 19 Aug 2018 21:40:50 +0000 (23:40 +0200)]
Made Apple II CONIO more flexible.

Originally the Apple II had a 64 char set and used the upper two bits to control inverse and blinking. The Apple //e brought then an alternate char set without blinking but more individual chars. However, it does _not_ contain 128 chars and use the upper bit to control inverse as one would assume. Rather it contains more than 128 chars - the MouseText chars. And because Apple wanted to provide as much backward compatibility as possible with the original char set, the alternate char set has a rather weird layout for chars > 128 with the inverse lowercase chars _not_ at (normal lowercase char + 128).

So far the Apple II CONIO implementation mapped chars 128-255 to chars 0-127 (with the exception of \r and \n). It made use of alternate chars > 128 transparently for the user via reverse(1). The user didn't have direct access to the MouseText chars, they were only used interally for things like chline() and cvline().

Now the mapping of chars 128-255 to 0-127 is removed. Using chars > 128 gives the user direct access to the "raw" alternate chars > 128. This especially give the use direct access to the MouseText chars. But this clashes with the exsisting (and still desirable) revers(1) logic. Combining reverse(1) with chars > 128 just doesn't result in anything usable!

What motivated this change? When I worked on the VT100 line drawing support for Telnet65 on the Apple //e (not using CONIO at all) I finally understood how MouseText is intended to be used to draw arbitrary grids with just three chars: A special "L" type char, the underscore and a vertical bar at the left side of the char box. I notice that with those chars it is possible to follow the CONIO approach to boxes and grids: Combining chline()/cvline() with special CH_... char constants for edges and intersections.

But in order to actually do so I needed to be able to define CH_... constants that when fed into the ordinary cputc() pipeline end up as MouseText chars. The obvious approach was to allow chars > 128 to directly access MouseText chars :-)

Now that the native CONIO box/grid approach works I deleted the Apple //e proprietary textframe() function that I added as replacement quite some years ago.

Again: Please note that chline()/cvline() and the CH... constants don't work with reverse(1)!

6 years agoFixed the system banking in the cbm510 and the cbm610 targets' versions of clock_gett...
Greg King [Sun, 19 Aug 2018 21:12:54 +0000 (17:12 -0400)]
Fixed the system banking in the cbm510 and the cbm610 targets' versions of clock_gettime() and clock_settime().

Their library function calls must run in the execution bank.

6 years agoWDM support (#721)
Stefan [Sun, 19 Aug 2018 14:29:25 +0000 (16:29 +0200)]
WDM support (#721)

WDM support

6 years agoOptimize for size.
Oliver Schmidt [Sun, 19 Aug 2018 12:35:30 +0000 (14:35 +0200)]
Optimize for size.

6 years agoFixed Visual C++ build (and some style adjustments).
Oliver Schmidt [Sat, 18 Aug 2018 22:01:40 +0000 (00:01 +0200)]
Fixed Visual C++ build (and some style adjustments).

6 years agoAdded dummy clock_settime() for the Atari.
Oliver Schmidt [Fri, 17 Aug 2018 23:36:56 +0000 (01:36 +0200)]
Added dummy clock_settime() for the Atari.

Allow to build ip65/date65.

6 years agoExpress assumption about struct timespec.
Oliver Schmidt [Fri, 17 Aug 2018 23:28:30 +0000 (01:28 +0200)]
Express assumption about struct timespec.

We basically cast a struct timespec pointer to a time_t pointer when we pass the clock_settime() paramter to localtime(). Explicitly express that in the source code.

6 years agoAdded clock_settime() for some CBMs.
Oliver Schmidt [Fri, 17 Aug 2018 23:13:02 +0000 (01:13 +0200)]
Added clock_settime() for some CBMs.

The CIA TOD only stores the time but not the date. Therefore the date set by clock_settime() ist just stored inside the C library for retrieval via clock_gettime().

The "very special" handling of 12AM/PM is based on https://groups.google.com/d/msg/comp.sys.cbm/ysVYSX4AMbc/vHrXCWEhCOUJ saying:

==========

24hr: Wr => Rd => Nx
--------------------
  0 : 92 => 12 => 01   <= Switch from 00 to 01 (24-hour notation)
  1 : 01 => 01 => 02
  2 : 02 => 02 => 03
 11 : 11 => 11 => 92
 12 : 12 => 92 => 81   <= Switch from 12 to 13 (24-hour notation)
 13 : 81 => 81 => 82
 14 : 82 => 82 => 83
 23 : 91 => 91 => 12

1. column ("24hr"): hour to be tested (decimal)
2. column ("Wr"):   hour written to TOD register (BCD)
3. column ("Rd"):   hour read from TOD register (BCD) immediately after writing the value in column 2 to see the conversion between AM/PM, if any
4. column ("Nx"):   next hour (BCD) after the hour switch

==========

Thanks Paul!

6 years agoFixed 12 AM/PM handling.
Oliver Schmidt [Fri, 17 Aug 2018 22:13:38 +0000 (00:13 +0200)]
Fixed 12 AM/PM handling.

Midnight is 12 AM and noon is 12 PM (see https://en.wikipedia.org/wiki/12-hour_clock). Therefore we need to subtract 12 hours in exactly those two hours.

6 years agoUse non-POSIX values for S_IREAD and S_IWRITE.
Patrick Pelletier [Fri, 17 Aug 2018 20:39:15 +0000 (13:39 -0700)]
Use non-POSIX values for S_IREAD and S_IWRITE.

(As requested in the PR.)

6 years agoDon't pass mode argument to open() from _fopen().
Patrick Pelletier [Fri, 17 Aug 2018 20:24:08 +0000 (13:24 -0700)]
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.

6 years agosim65: Use mode_t for OMode.
Patrick Pelletier [Fri, 17 Aug 2018 20:17:38 +0000 (13:17 -0700)]
sim65: Use mode_t for OMode.

6 years agosim65: Blindly guessing to get Travis build to pass.
Patrick Pelletier [Fri, 17 Aug 2018 19:09:20 +0000 (12:09 -0700)]
sim65: Blindly guessing to get Travis build to pass.

6 years agosim65: Build was failing on Windows, too.
Patrick Pelletier [Fri, 17 Aug 2018 18:53:19 +0000 (11:53 -0700)]
sim65: Build was failing on Windows, too.

Microsoft loves putting underscores in front of everything!

6 years agosim65: S_IREAD and S_IWRITE are nonstandard.
Patrick Pelletier [Fri, 17 Aug 2018 18:20:34 +0000 (11:20 -0700)]
sim65: S_IREAD and S_IWRITE are nonstandard.

The Linux build was failing with:

sim65/paravirt.c: In function ‘PVOpen’:
sim65/paravirt.c:217:18: error: ‘S_IREAD’ undeclared (first use in this function)
         OMode |= S_IREAD;
                  ^
sim65/paravirt.c:217:18: note: each undeclared identifier is reported only once for each function it appears in
sim65/paravirt.c:220:18: error: ‘S_IWRITE’ undeclared (first use in this function)
         OMode |= S_IWRITE;
                  ^
make[1]: *** [../wrk/sim65/paravirt.o] Error 1

6 years agosim65: If mode argument is omitted, use a reasonable default.
Patrick Pelletier [Fri, 17 Aug 2018 17:50:16 +0000 (10:50 -0700)]
sim65: If mode argument is omitted, use a reasonable default.

6 years agoAllow "mode" argument to open() to be passed from 6502 code.
Patrick Pelletier [Fri, 17 Aug 2018 17:43:14 +0000 (10:43 -0700)]
Allow "mode" argument to open() to be passed from 6502 code.

Implements this suggestion:
https://github.com/cc65/cc65/pull/719#issuecomment-413809096

6 years agoFix permissions for files created by sim65.
Patrick Pelletier [Fri, 17 Aug 2018 06:39:31 +0000 (23:39 -0700)]
Fix permissions for files created by sim65.

Files created by my programs running under sim65 had really weird permissions:
--w-r--r-x  1 ppelleti  staff  19 Aug 16 23:22 json.test.print.tmp

So, for example, my program running under sim65 was not able to read
the file it had just written.

This is because the third argument to open (mode) was not being
specified in paravirt.c, so it was just picking up random crud off the
stack to use as the mode.

I added a mode of 0666, and now my program runs correctly.

6 years agoFixed the generation of the opcode byte when BRK is given an operand, in 65816 CPU...
Greg King [Fri, 17 Aug 2018 03:51:04 +0000 (23:51 -0400)]
Fixed the generation of the opcode byte when BRK is given an operand, in 65816 CPU mode.

The bug was created by commit 7e8bb7b700572a50ed4f1e87ebeea4fd35177459.

6 years agoAdded clock_getres() / clock_settime() for the Apple II.
Oliver Schmidt [Wed, 15 Aug 2018 19:34:35 +0000 (21:34 +0200)]
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.

6 years agoMinor style fix.
Oliver Schmidt [Wed, 15 Aug 2018 17:40:56 +0000 (19:40 +0200)]
Minor style fix.

6 years agoAdded clock_getres() for CBMs.
Oliver Schmidt [Wed, 15 Aug 2018 17:40:27 +0000 (19:40 +0200)]
Added clock_getres() for CBMs.

All CBMs have a clock (CIA TOD) resolution of 1/10 second.

6 years agoReplaced _systime with clock_gettime.
Oliver Schmidt [Wed, 15 Aug 2018 13:59:11 +0000 (15:59 +0200)]
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().

6 years agoRemoved stray /t char.
Oliver Schmidt [Tue, 14 Aug 2018 14:00:09 +0000 (16:00 +0200)]
Removed stray /t char.

6 years agoFixed typo.
Oliver Schmidt [Tue, 14 Aug 2018 13:54:57 +0000 (15:54 +0200)]
Fixed typo.

6 years agoAdded CHKOUT and CLRCHN
Olli Savia [Tue, 14 Aug 2018 18:09:03 +0000 (21:09 +0300)]
Added CHKOUT and CLRCHN