Compiling string literals in ASM for SDCC/LCC

439 views Asked by At

I'm trying to write string literals in ASM for GBDK's LCC. I can write each individual character and the compiler is working fine.

.D_LINE = 0x0A
;; Works
.db "G", "I", "A", "N", "L", "U", "C", "A", #.D_LINE

However, when I try and combine the characters into a single string to make it more readable:

.D_LINE = 0x0A
;; Doesn't work
.db "GIANLUCA", #.D_LINE

I get a compilation error:

text.s:12: Error: <o> .org in REL area or directive / mnemonic error

Is there any way to get around this?

Version information

$ lcc -v
lcc $Id: lcc.c,v 1.6 2001/10/28 18:38:13 michaelh Exp $

$ sdcc -v
SDCC : gbz80/z80 2.3.1/gbdk-2.96a (Nov  4 2001) (UNIX) 
1

There are 1 answers

0
Polluks On BEST ANSWER

Here comes the directive list:

NULL,   ".byte",    S_BYTE,     0,  0,
NULL,   ".db",      S_BYTE,     0,  0,
NULL,   ".word",    S_WORD,     0,  0,
NULL,   ".dw",      S_WORD,     0,  0,
NULL,   ".df",      S_FLOAT,    0,  0,
NULL,   ".ascii",   S_ASCII,    0,  0,
NULL,   ".asciz",   S_ASCIZ,    0,  0,
NULL,   ".blkb",    S_BLK,      0,  1,
NULL,   ".ds",      S_BLK,      0,  1,
NULL,   ".blkw",    S_BLK,      0,  2,
NULL,   ".page",    S_PAGE,     0,  0,
NULL,   ".title",   S_TITLE,    0,  0,
NULL,   ".sbttl",   S_SBTL,     0,  0,
NULL,   ".globl",   S_GLOBL,    0,  0,
NULL,   ".area",    S_DAREA,    0,  0,
NULL,   ".even",    S_EVEN,     0,  0,
NULL,   ".odd",     S_ODD,      0,  0,
NULL,   ".if",      S_IF,       0,  0,
NULL,   ".else",    S_ELSE,     0,  0,
NULL,   ".endif",   S_ENDIF,    0,  0,
NULL,   ".include", S_INCL,     0,  0,
NULL,   ".radix",   S_RADIX,    0,  0,
NULL,   ".org",     S_ORG,      0,  0,
NULL,   ".module",  S_MODUL,    0,  0,
NULL,   ".ascis",   S_ASCIS,    0,  0,

see https://github.com/hschmitt/gbdk/blob/d7707bf2b3c5433edcd37d53a1475fd51a9b9502/as/z80pst.c