Difference between revisions of "SDCC"

From MSX Game Library

Line 6: Line 6:
 
* Define instructions numeral values: must be prefixed with <tt>#</tt> character.
 
* Define instructions numeral values: must be prefixed with <tt>#</tt> character.
 
* Define directive: must be prefix 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 into parentheses before the register name.
+
* Access to IX and IY register using offset: offset have to be write before the register name into parentheses.
  
 
{| class="wikitable"
 
{| class="wikitable"
Line 13: Line 13:
 
! sdasz80
 
! sdasz80
 
|-
 
|-
| <syntaxhighlight lang="x86asm">
+
| <syntaxhighlight lang="z80asm">
 
; Numeral
 
; Numeral
ld   a, 100
+
ld     a, 100
 +
and    01111100b
 +
ld      lh, 1234h
  
 
; Directive
 
; Directive
db   100
+
db     100
 +
dw      1234h
  
 
; IX/IY offset
 
; IX/IY offset
 +
ld      e, iy[0]
 +
ld      d, iy[1]
 
</syntaxhighlight>
 
</syntaxhighlight>
| <syntaxhighlight lang="x86asm">
+
| <syntaxhighlight lang="z80asm">
 
; Numeral
 
; Numeral
ld   a, #100
+
ld     a, #100
 +
and    #0b01111100
 +
ld      lh, #0x1234
  
 
; Directive
 
; Directive
.db   100
+
.db     100
 +
.dw    0x1234
  
 
; IX/IY offset
 
; IX/IY offset
 +
ld      e, 0(iy)
 +
ld      d, 1(iy)
 
</syntaxhighlight>
 
</syntaxhighlight>
 
|}
 
|}

Revision as of 13:25, 22 January 2024

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

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      lh, 1234h

; Directive
db      100
dw      1234h

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

; Directive
.db     100
.dw     0x1234

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

Links: