Difference between revisions of "SDCC"

From MSX Game Library

(Created page with "SDCC is the toolchain used in {{MSXgl}} to compile, assemble and link the sources files. Links: * [http://sdcc.sourceforge.net/doc/sdccman.pdf SDCC documentation]")
 
(SDCC 4.2.0)
 
(32 intermediate revisions by the same user not shown)
Line 1: Line 1:
[[SDCC]] is the toolchain used in {{MSXgl}} to compile, assemble and link the sources files.
+
[[SDCC]] is the toolchain used in {{MSXGL}} to compile, assemble and link the sources files.
  
Links:
+
Supported version:
 +
* Embedded: <tt>SDCC 4.2.0</tt>
 +
* Last tested: <tt>SDCC 4.4.0 RC3</tt> (Windows) and <tt>SDCC 4.4.0</tt> (Linux)
 +
 
 +
== Assembler ==
 +
 
 +
The assembler, '''sdasz80''', is based on ASxxxx cross assembles.
 +
 
 +
sdasz80 syntax is almost standard except for:
 +
* Define instructions numeral values: must be prefixed with <tt>#</tt> character.
 +
* Define directive: must be prefix with <tt>.</tt> character.
 +
* Access to IX and IY register using offset: offset have to be write before the register name into parentheses.
 +
 
 +
{| class="wikitable"
 +
|-
 +
! Standard
 +
! sdasz80
 +
|-
 +
| <syntaxhighlight lang="z80asm">
 +
; Numeral
 +
ld      a, 100
 +
and    01111100b
 +
ld      hl, 1234h
 +
 
 +
; Directive
 +
db      100
 +
dw      1234h
 +
 
 +
; IX/IY offset
 +
ld      e, iy[0]
 +
ld      d, iy[1]
 +
</syntaxhighlight>
 +
| <syntaxhighlight lang="z80asm">
 +
; Numeral
 +
ld      a, #100
 +
and    #0b01111100
 +
ld      hl, #0x1234
 +
 
 +
; Directive
 +
.db    100
 +
.dw    0x1234
 +
 
 +
; IX/IY offset
 +
ld      e, 0(iy)
 +
ld      d, 1(iy)
 +
</syntaxhighlight>
 +
|}
 +
 
 +
== Versions ==
 +
 
 +
=== <tt>SDCC 4.2.0</tt> ===
 +
Currently recommended version for MSXgl.
 +
 
 +
* ⭐ '''Main features:'''
 +
** New calling convention (use register to pass function parameters)
 +
 
 +
* 🧾 '''Full change-log:'''
 +
** C23 <tt>memset_explicit</tt>
 +
** Support for <tt>--oldralloc</tt> has been removed from the z80 backends.
 +
** Full support for <tt>__z88dk_callee</tt> for the z80 backends.
 +
** Support for a new <tt>__sdcccall(1)</tt> calling convention in the z80 AS NEW DEFAULT.
 +
** Removed support for <tt>--profile</tt> for z80 backends.
 +
** The z80n port Z80N Core minimum version has been raised from 1.0 to 2.0.
 +
** Improved rematerialization support in the z80 backends.
 +
 
 +
* ⚠️ '''Known issues:'''
 +
** None
 +
 
 +
=== <tt>SDCC 4.3.0</tt> ===
 +
* ⭐ '''Main features:'''
 +
** Support for undocumented Z80 instructions
 +
 
 +
* 🧾 '''Full change-log:'''
 +
** Added all new general mnemonics from ASxxxx 5.40 except for .bank and enabled for all ports
 +
** sm83: sdasgb now can output cycles in listing and sz80 has accurate cycles for this processor except for branching
 +
** struct / union parameters and return.
 +
** div standard library function family.
 +
** Many fixes for the type system and _Generic.
 +
** Adopted more of GCC, QuickC and tinycc tests.
 +
** C2X bit-precise integer types and bit-fields thereof for. C2X nullptr, char8_t, memalignment, unreachable, typeof, typeof_unqual, auto. C2X keywords bool, true, false, alignas, alignof, static_assert. C2X bit and byte utilities.
 +
** C90-C17 function declarators without prototypes.
 +
** C99 variably modified types.
 +
** <tt>call_once</tt>.
 +
** <tt>_sdcc_external_startup</tt> renamed to <tt>__sdcc_external_startup</tt> and supported for all ports.
 +
** makeshift support for long double as another alias for float.
 +
 
 +
* ⚠️ '''Known issues:'''
 +
** Most of the projects can increase significantly in final size.
 +
** Bug with undocumented Z80 instructions generation that can generate compilation errors.
 +
 
 +
=== <tt>SDCC 4.4.0</tt> ===
 +
* ⭐ '''Main features:'''
 +
** Native support for ASCII R800, the MSX turbo R's CPU.
 +
 
 +
* 🧾 '''Full change-log:'''
 +
** Optimizations for rotations.
 +
** Generalized constant propagation.
 +
** New command line option <tt>--syntax-only</tt> to only parse the input.
 +
** Added C99 header <tt>inttypes.h</tt>
 +
** Added library functions imaxabs, imaxdiv, llabs, strtoimax, strtoll, strtoull, strtoumax, wcsncmp, wcstoimax, wcstol, wcstoll, wcstoul, wcstoull, wcstoumax
 +
** New r800 port to better support the ASCII Corp R800 and Zilog Z280.
 +
** Improved optimizations for code speed for stm8, pdk, z80 (and related).
 +
 
 +
* ⚠️ '''Known issues:'''
 +
** On Windows, win32 version just doesn't works and win64 is... absent. You can use [https://sourceforge.net/projects/sdcc/files/sdcc-win64/4.4.0/ win64 version of <tt>SDCC 4.4.0 RC3</tt>] (same content than the official release).
 +
** Some projects can increase significantly in final size.
 +
** Some projects are broken when compiled with SDCC 4.4.0 (''Clock'' sample and ''Phenix Corrupta'' project).
 +
 
 +
== Links ==
 +
 
 +
For more information:
 +
* [https://sdcc.sourceforge.net/ SDCC homepage]
 
* [http://sdcc.sourceforge.net/doc/sdccman.pdf SDCC documentation]
 
* [http://sdcc.sourceforge.net/doc/sdccman.pdf SDCC documentation]
 +
* [https://shop-pdp.net/ashtml/asmlnk.pdf ASxxxx documentation]

Latest revision as of 19:52, 30 March 2024

SDCC is the toolchain used in MSXGL to compile, assemble and link the sources files.

Supported version:

  • Embedded: SDCC 4.2.0
  • Last tested: SDCC 4.4.0 RC3 (Windows) and SDCC 4.4.0 (Linux)

Assembler

The assembler, sdasz80, is based on ASxxxx cross assembles.

sdasz80 syntax is almost standard except for:

  • Define instructions numeral values: must be prefixed with # character.
  • Define directive: must be prefix with . character.
  • Access to IX and IY register using offset: offset have to be write before the register name into parentheses.
Standard sdasz80
; Numeral
ld      a, 100
and     01111100b
ld      hl, 1234h

; Directive
db      100
dw      1234h

; IX/IY offset
ld      e, iy[0]
ld      d, iy[1]
; Numeral
ld      a, #100
and     #0b01111100
ld      hl, #0x1234

; Directive
.db     100
.dw     0x1234

; IX/IY offset
ld      e, 0(iy)
ld      d, 1(iy)

Versions

SDCC 4.2.0

Currently recommended version for MSXgl.

  • Main features:
    • New calling convention (use register to pass function parameters)
  • 🧾 Full change-log:
    • C23 memset_explicit
    • Support for --oldralloc has been removed from the z80 backends.
    • Full support for __z88dk_callee for the z80 backends.
    • Support for a new __sdcccall(1) calling convention in the z80 AS NEW DEFAULT.
    • Removed support for --profile for z80 backends.
    • The z80n port Z80N Core minimum version has been raised from 1.0 to 2.0.
    • Improved rematerialization support in the z80 backends.
  • ⚠️ Known issues:
    • None

SDCC 4.3.0

  • Main features:
    • Support for undocumented Z80 instructions
  • 🧾 Full change-log:
    • Added all new general mnemonics from ASxxxx 5.40 except for .bank and enabled for all ports
    • sm83: sdasgb now can output cycles in listing and sz80 has accurate cycles for this processor except for branching
    • struct / union parameters and return.
    • div standard library function family.
    • Many fixes for the type system and _Generic.
    • Adopted more of GCC, QuickC and tinycc tests.
    • C2X bit-precise integer types and bit-fields thereof for. C2X nullptr, char8_t, memalignment, unreachable, typeof, typeof_unqual, auto. C2X keywords bool, true, false, alignas, alignof, static_assert. C2X bit and byte utilities.
    • C90-C17 function declarators without prototypes.
    • C99 variably modified types.
    • call_once.
    • _sdcc_external_startup renamed to __sdcc_external_startup and supported for all ports.
    • makeshift support for long double as another alias for float.
  • ⚠️ Known issues:
    • Most of the projects can increase significantly in final size.
    • Bug with undocumented Z80 instructions generation that can generate compilation errors.

SDCC 4.4.0

  • Main features:
    • Native support for ASCII R800, the MSX turbo R's CPU.
  • 🧾 Full change-log:
    • Optimizations for rotations.
    • Generalized constant propagation.
    • New command line option --syntax-only to only parse the input.
    • Added C99 header inttypes.h
    • Added library functions imaxabs, imaxdiv, llabs, strtoimax, strtoll, strtoull, strtoumax, wcsncmp, wcstoimax, wcstol, wcstoll, wcstoul, wcstoull, wcstoumax
    • New r800 port to better support the ASCII Corp R800 and Zilog Z280.
    • Improved optimizations for code speed for stm8, pdk, z80 (and related).
  • ⚠️ Known issues:
    • On Windows, win32 version just doesn't works and win64 is... absent. You can use win64 version of SDCC 4.4.0 RC3 (same content than the official release).
    • Some projects can increase significantly in final size.
    • Some projects are broken when compiled with SDCC 4.4.0 (Clock sample and Phenix Corrupta project).

Links

For more information: