#2206 .rept directive in sdas doesn't seem to work

closed-fixed
None
sdas
5
2014-08-15
2013-08-19
No

Apologies if this is a simple case of pebkac, but I can't seem to get the .rept directive of sdasz80 to work (at least as expected). For example:

    .area   _CODE

_tryme::
    ld  b, #5

    .rept   2
    .byte   0x5E    
    ld  a, #5
    .endm

    ld  h, l
    ret

Assmbled using:

$ sdasz80 -plosffwz rept.s
$ cat rept.lst
                              1 
                              2     .area   _CODE
                              3 
   0000                       4 _tryme::
   0000 06 05         [ 7]    5     ld  b, #5
                              6 
                              7     .rept   2
                              8     .byte   0x5E    
                              9     ld  a, #5
                             10     .endm
                              1 
                              2 
                              3 
                              1 
                              2 
                              3 
                             11 
   0002 65            [ 4]   12     ld  h, l
   0003 C9            [10]   13     ret
                             14 

It seems that the repeat is working, as between lines 10 and 11, there are 2 repeats of "1,2,3" (and the number of repeats changes in accordance with the .rept argument). However, the lines are blank, and there doesn't seem to be anything produced in the .rel file for these. In fact, all I get is:

XL2
H 1 areas 2 global symbols
S .__.ABS. Def0000
A _CODE size 4 flags 0 addr 0
S _tryme Def0000
T 00 00
R 00 00 00 00
T 00 00 06 05 65 C9
R 00 00 00 00

So the two loads at lines 5 and 12 make it in there, but neither the 0x5E (line 8) or the load (line 9) within the rept section are kept.

I was looking for a neater alternative to writing out ".byte 0x5E, 0x5E, 0x5E, 0x5E, 0x5E, 0x5E, 0x5E, 0x5E, ...etc..." where the number of repeated values is 257. ".rept" appears to do what I want, but doesn't work (or I'm using it wrong). What I'd like to do is this:

.rept 257
.byte 0x5E
.endm

and end up with 257 copies of 0x5E inserted at that point.

I'm using sdasz80 which comes with:
$ sdcc -v
SDCC : z80 3.3.1 #8787 (Jul 30 2013) (Solaris i386)
(built from source, Z80 only).

Is this a bug, or am I using it wrong?

Discussion

  • Maarten Brock

    Maarten Brock - 2014-01-03
    • status: open --> closed-fixed
    • assigned_to: Maarten Brock
     
  • Maarten Brock

    Maarten Brock - 2014-01-03

    Fixed in SDCC 3.3.2 #8936.

     

Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:





No, thanks