break;
}
}
+ /* Remove leading zeros from dollar local labels if SDCC compat enabled. */
+ if (sdcc_compat && *input_line_pointer == '0')
+ {
+ char *dollar;
+
+ /* SDCC emits at most one label definition per line, so it is
+ enough to look at only the first label. Hand-written asm
+ might use more, but then it is unlikely to use leading zeros
+ on dollar local labels. */
+
+ /* Place p at the first character after [0-9]+. */
+ for (p = input_line_pointer; *p >= '0' && *p <= '9'; ++p)
+ ;
+
+ /* Is this a dollar sign label?
+ GAS allows spaces between $ and :, but SDCC does not. */
+ if (p[0] == '$' && p[1] == ':')
+ {
+ dollar = p;
+ /* Replace zeros with spaces until the first non-zero,
+ but leave the last character before $ intact (for e.g. 0$:). */
+ for (p = input_line_pointer; *p == '0' && p < dollar - 1; ++p)
+ {
+ *p = ' ';
+ }
+ }
+ }
/* Check for <label>[:] =|([.](EQU|DEFL)) <value>. */
if (is_name_beginner (*input_line_pointer))
{
+;; This file uses syntax emitted by the Small Device C Compiler. It
+;; is used to test the -sdcc flag to the z80 assembler. Modifications
+;; to this file should take care to keep SDCC syntax.
+
.module longpolls
.optsdcc -mz80
_start::
;comment
ld hl, #4+0
-0$:
+00000$:
adc a, a
adc a, b
adc a, c
adc a, (hl)
adc a, 5 (ix)
adc a, -2 (iy)
-100$:
+00100$:
add a, a
add a, b
add a, c
add a, (hl)
add a, 5 (ix)
add a, -2 (iy)
-200$:
+00200$:
and a, a
and a, b
and a, c
and a, (hl)
and a, 5 (ix)
and a, -2 (iy)
-300$:
+00300$:
cp a, a
cp a, b
cp a, c
cp a, (hl)
cp a, 5 (ix)
cp a, -2 (iy)
-400$:
+00400$:
or a, a
or a, b
or a, c
or a, (hl)
or a, 5 (ix)
or a, -2 (iy)
-500$:
+00500$:
sbc a, a
sbc a, b
sbc a, c
sbc a, (hl)
sbc a, 5 (ix)
sbc a, -2 (iy)
-600$:
+00600$:
sub a, a
sub a, b
sub a, c
sub a, (hl)
sub a, 5 (ix)
sub a, -2 (iy)
-700$:
+00700$:
xor a, a
xor a, b
xor a, c
xor a, 5 (ix)
xor a, -2 (iy)
- jp 0$
- jp 100$
- jp 200$
- jp 300$
- jp 500$
- jp 600$
- jp 700$
+ jp 00000$
+ jp 00100$
+ jp 00200$
+ jp 00300$
+ jp 00500$
+ jp 00600$
+ jp 00700$
_func:
ld hl,0
ld (hl),#<function
-100$:
+00100$:
inc hl
ld (hl),#>function
-600$:
- jr 100$
+00600$:
+ jr 00100$
_finish::
ld a, 2 (iy)
ld -1 (ix), a