1
0
mirror of https://github.com/cc65/cc65.git synced 2024-06-07 23:29:39 +00:00
cc65 - a freeware C compiler for 6502 based systems
Go to file
Jesse Rosenstock c4698dfd07 Use C89 semantics for integer conversions
Previously, the following rules were used for binary operators:
* If one of the values is a long, the result is long.
* If one of the values is unsigned, the result is also unsigned.
* Otherwise the result is an int.

C89 specifies the "usual arithmetic conversions" as:
* The integral promotions are performed on both operands.
* Then the following rules are applied:
  * If either operand has type unsigned long int, the other operand is
    converted to unsigned long int.
  * Otherwise, if one operand has type long int and the other has type
    unsigned int, if a long int can represent all values of an unsigned int,
    the operand of type unsigned int is converted to long int; if a long int
    cannot represent all the values of an unsigned int, both operands are
    converted to unsigned long int.
  * Otherwise, if either operand has type long int, the other operand is
    converted to long int.
  * Otherwise, if either operand has type unsigned int, the other operand is
    converted to unsigned int.
  * Otherwise, both operands have type int.
https://port70.net/~nsz/c/c89/c89-draft.html#3.2.1.5

As one example, these rules give a different result for an operator
with one long operand and one unsigned int operand.  Previously,
the result type was unsigned long.  With C89 semantics, it is just long,
since long can represent all unsigned ints.

Integral promotions convert types shorter than int to int (or unsigned int).
Both char and unsigned char are promoted to int since int can represent
all unsigned chars.
https://port70.net/~nsz/c/c89/c89-draft.html#3.2.1.1

Rename promoteint to ArithmeticConvert, since this is more accurate.

Fixes #170
2020-08-15 19:14:31 +02:00
asminc Added waitvsync() for the Enhanced Apple //e. 2020-06-18 21:44:57 +02:00
cfg Added a 160x192x2 TGI (graphics) driver to the VIC-20 library. 2020-07-08 05:55:30 -04:00
doc Fixed a typo in the CX16 document. 2020-07-16 14:06:23 -04:00
include Add support for static_assert 2020-07-30 19:17:11 +02:00
libsrc Move comment block as requested 2020-07-24 15:24:28 -04:00
samples Added a 320x200x256 TGI driver to the Commander X16 library. 2020-07-15 17:30:58 -04:00
src Use C89 semantics for integer conversions 2020-08-15 19:14:31 +02:00
test Use C89 semantics for integer conversions 2020-08-15 19:14:31 +02:00
testcode make it actually compile again :) 2020-08-14 21:07:39 +02:00
util Removed unnecessary tool. 2020-07-19 13:16:29 +02:00
.gitattributes Added .gitattributes to force LF line endings on commit. 2017-03-12 18:13:18 +01:00
.gitignore Don't ignore more than necessary. 2016-06-01 22:36:38 +02:00
.travis.yml Fixed Windows path notation. 2020-08-02 17:49:18 +02:00
LICENSE Simplified license. 2015-05-05 21:56:23 +02:00
Makefile Added test target. 2020-07-22 23:27:04 +02:00
Makefile.travis The doc now lives in the 'master' branch of the 'doc' project. 2018-09-18 23:39:11 +02:00
README.md Normalized Atari naming. 2020-02-17 11:07:52 +01:00

Windows Snapshot

Documentation

Wiki

Build Status

cc65 is a complete cross development package for 65(C)02 systems, including a powerful macro assembler, a C compiler, linker, librarian and several other tools.

cc65 has C and runtime library support for many of the old 6502 machines, including

  • the following Commodore machines:
    • VIC20
    • C16/C116 and Plus/4
    • C64
    • C128
    • CBM 510 (aka P500)
    • the 600/700 family
    • newer PET machines (not 2001).
  • the Apple ][+ and successors.
  • the Atari 8-bit machines.
  • the Atari 2600 console.
  • the Atari 5200 console.
  • GEOS for the C64, C128 and Apple //e.
  • the Bit Corporation Gamate console.
  • the NEC PC-Engine (aka TurboGrafx-16) console.
  • the Nintendo Entertainment System (NES) console.
  • the Watara Supervision console.
  • the VTech Creativision console.
  • the Oric Atmos.
  • the Oric Telestrat.
  • the Lynx console.
  • the Ohio Scientific Challenger 1P.

The libraries are fairly portable, so creating a version for other 6502s shouldn't be too much work.