z88dk-dis making labels by it self

Requests for features
cborn
Well known member
Posts: 264
Joined: Tue Oct 06, 2020 7:45 pm

Re: z88dk-dis making labels by it self

Post by cborn »

Hi
if i add '-a' to the command line it should have the Lxxyy label, is that correct? since it seems not to work on my install

Code: Select all

z88dk-dis  -a -x  this.map      -o 30789 -mz80 fruit16k.bin > fruit16k_009.asm
buildscr:
                    ld      a,$32                           ;[7845] 3e 32
                    ld      (ATTRT),a                       ;[7847] 32 8f 5c
nxtchr:
                    ld      a,e                             ;[784a] 7b
                    rst     $10                             ;[784b] d7
                    ld      a,c                             ;[784c] 79
                    rst     $10                             ;[784d] d7
                    ld      a,$01                           ;[784e] 3e 01
                    rst     $10                             ;[7850] d7
                    ld      b,$19                           ;[7851] 06 19
I found its set with 'c_autolabel' and i found that back
like in, which seems twice the same print statement. probably i see it wrong.
but in both cases of C_autolabel the same start2+= and equal printf statements are used
i asume only the first while is needed, but lacking the real c_autolable output, which COULD be "Lxxyy"
but i am not sure at al

Code: Select all

static void disassemble_loop(int start, int end)
{
    static char buf[2048];
    int start2 = start;

    while ( start2 < end ) {
        start2 += disassemble2(start2, buf, sizeof(buf), 0);
        if (c_autolabel) {
            printf("%s\n",buf);
        }
    }

    if ( c_autolabel ) {
        start2 = start;
        while ( start2 < end ) {
            start2 += disassemble2(start2, buf, sizeof(buf), 0);
            printf("%s\n",buf);
        }
    }
}

MAYBE ??

Code: Select all

static void disassemble_loop(int start, int end)
{
    static char buf[2048];
    int start2 = start;

    while ( start2 < end ) {
        start2 += disassemble2(start2, buf, sizeof(buf), 0);
        if (c_autolabel) { printf("%s\n", label ); }
        printf("%s\n",buf);
    }
}
User avatar
dom
Well known member
Posts: 2014
Joined: Sun Jul 15, 2007 10:01 pm

Re: z88dk-dis making labels by it self

Post by dom »

It looks like autolabels broke with some work on the debugger.

Should be good from the the 20230917 nightly.
cborn
Well known member
Posts: 264
Joined: Tue Oct 06, 2020 7:45 pm

Re: z88dk-dis making labels by it self

Post by cborn »

thank you,
i should do a refresh anyway.
are there standard maps vailable? i just collected all rom routine and subroutine lables from
https://github.com/ZXSpectrumVault/rom- ... trum48.asm
i have to check if i did all correct. and ofcourse there are double names already within the "official" Rom dissambly. the report names double.
are there all ready standard names for those doubles? that would be easy and compatible.
cborn
Well known member
Posts: 264
Joined: Tue Oct 06, 2020 7:45 pm

Re: z88dk-dis making labels by it self

Post by cborn »

Hi,
i tried the difference with and with out '-a' and i think i does not work. if i see it correct the dissambler is a part off the ticks counter and the debugger. thats the goal off z88dk-dis, to assist those routines. My request is a bit in the way off the primairy goal, counting ticks and debug.

to test what happen with '-a' i added "autoload found" to the CASE of '-a. that works ok
i added 'L' to the 2nd line with printf("%s\n",buf); in 'disassemble_loop(int start, int end)' which works since every label or adres then starts with L . to much but it works
form 5 files handling 'c_autolabel' 4 set this var to 0. Is it perhaps easier to just make that extra label in an string, and if the string is empty its not changing code and if the string is used it will be printed.
then hopefully the decision route for ticks and debugger will not be crippled for/by some extra printing.

further in need some assistence with detecting the DATA label use you mentioned. Although perhaps you say they ar Not noticed
" won’t attempt to disassemble bss, data and rodata sections as named by z88dk"
Do i have to set a variable for that? perhaps the its possible to set a " DEFB x,y" list or a selct a string.
hmm, setting an"defb " is actualy disassembling which is not attempted.
cborn
Well known member
Posts: 264
Joined: Tue Oct 06, 2020 7:45 pm

Re: z88dk-dis making labels by it self

Post by cborn »

example

Code: Select all

SECTION DATA
org $787f
section bigdat_1
bigdat1     equ $787f
bline1      equ $7880  ;
bline1b     equ $7881  ;
bline1c     equ $7882  ;
bline1d     equ $7883  ;
bline1e     equ $7884  ;
str_stp     equ $7885
some data presets are ignored

Code: Select all

bigdat1:
                    ld      (de),a                          ;[787f] 12
bline1:
                    ld      c,h                             ;[7880] 4c
bline1b:
                    djnz    bline1e                         ;[7881] 10 01
bline1d:
                    inc     bc                              ;[7883] 03
bline1e:
                    ex      af,af'                          ;[7884] 08
User avatar
dom
Well known member
Posts: 2014
Joined: Sun Jul 15, 2007 10:01 pm

Re: z88dk-dis making labels by it self

Post by dom »

I'm sorry, I've got a lot going on (IRL) at the moment so you'll need to spoon-feed me - I've completely lost track of what the issue is.

What is it you're trying to do? What isn't working as you'd expect? What do you want to happen?

If you can zip up a project with instructions on how to reproduce that would be very helpful.
cborn
Well known member
Posts: 264
Joined: Tue Oct 06, 2020 7:45 pm

Re: z88dk-dis making labels by it self

Post by cborn »

Hi Dom,
i have two(tree) questions. the first is about '-a' which does not show any difference if I use it or not. neither with '-aL'.
then my remark about '-a' is that z88dk-dis is part off ticks and other routines and thus making it print is probably not 'handy'
its not importend so we can dump the idear. thats much easier. maybe its not a question but the remark that if my request blocks aka make difficulties for other routines you better dont implement it.

my other question is about '-x' and the correponding map file.
if i set a row off labels then some labels are ommited by z88dk-dis.
in the above example the preset lable
bline1c equ $7882 ;
is Not used by z88dk-dis
i asume that happens becouse as 1st pass the ASM is filled in and as 2nd pass the labels are added.
After implementing 'jr xx' the counter is raised with 2 and thus the next BYTE is skipped and NOT used as a reference
there comes question nr 3
i had in mind that i would be able to mark a DATA block which then is set as block of DEFB x,y,z,a,b,c
for that i thoughed to have found the common SECTION DATA
but that is probably a fully C coding and outside the reach of z88dk-dis
i hope i explained it ;)
User avatar
dom
Well known member
Posts: 2014
Joined: Sun Jul 15, 2007 10:01 pm

Re: z88dk-dis making labels by it self

Post by dom »

For the first part, -a. I'm going to use the ZX ROM because everyone has a copy of that:

Code: Select all

% z88dk-dis -o 0 48.rom

                    di                                      ;[0000] f3
                    xor       a                             ;[0001] af
                    ld        de,$ffff                      ;[0002] 11 ff ff
                    jp        $11cb                         ;[0005] c3 cb 11
                    ld        hl,($5c5d)                    ;[0008] 2a 5d 5c
                    ld        ($5c5f),hl                    ;[000b] 22 5f 5c
                    jr        $0053                         ;[000e] 18 43
                    jp        $15f2                         ;[0010] c3 f2 15
Adding on -a:

Code: Select all

% z88dk-dis -a -o 0 48.rom

L0000:
                    di                                      ;[0000] f3
                    xor       a                             ;[0001] af
                    ld        de,$ffff                      ;[0002] 11 ff ff
                    jp        L11cb                         ;[0005] c3 cb 11
                    ld        hl,(L5c5d)                    ;[0008] 2a 5d 5c
                    ld        (L5c5f),hl                    ;[000b] 22 5f 5c
                    jr        L0053                         ;[000e] 18 43
                    jp        L15f2                         ;[0010] c3 f2 15
 
I'll get onto the second bit later on today - at first glance it looks like it's probably partly this issue: https://github.com/z88dk/z88dk/issues/1913 which I've not come up with a neat solution for.
cborn
Well known member
Posts: 264
Joined: Tue Oct 06, 2020 7:45 pm

Re: z88dk-dis making labels by it self

Post by cborn »

Your example clearly has a L0000 label
on my install that is not working, there is no difference in both disassemblies, which means my install misses something or its a different version off something.
Post Reply