nejohnson / dasmxx

Small processor disassembler suite
22 stars 3 forks source link

disassembly start address doesn't work #12

Closed smdjeff closed 20 hours ago

smdjeff commented 1 day ago

It seems that c5400 results in an output that says it's disassembling at 0x5400 but those bytes are from 0x0000

;   Processing "romset.bin" (49152 bytes)
;   Disassembly start address: 0x5400
;   String terminator: 0x00

___CL_0001:
    5400:    C3             ???      
    5401:    06             ???      
    5402:    00             NOP      
    5403:    C3             ???      
    5404:    1A             INC      R2
    5405:    01             ???      
    5406:    F3             ???   
nejohnson commented 1 day ago

Can you post the binary file?

smdjeff commented 1 day ago

Actually maybe I'm just not understanding the syntax. If I want to skip the first 0x53FF bytes and then start disassembly as if 0x5400 was 0x0000 how do you do that? I can't seem to find the combination.

nejohnson commented 1 day ago

What you could try is put a 'b0000' first, then 'c5400'. You'll get a load of binary dump, and then your binary. The skip command is really for handling zeroed data and will fail if the skipped bytes are not zero. Do you want the code disasm to have address 0x0000 when dumped from 0x5400? The myriad ways that embedded systems connect up ROMs to CPUs makes it an interesting problem with many corner cases!

nejohnson commented 1 day ago

If you don't need the first 0x5400 bytes from the ROM image then you could just "tail" the file, something like "tail -c +21505 romset.bin > 5400romset.bin"

nejohnson commented 1 day ago

And then just 'c5400' will treat the start of the file as being address 0x5400.

nejohnson commented 1 day ago

But I can see it might be useful for the skip command to be able to skip any data not just zero data, although the purpose of the skip is more when generating assembler output.

smdjeff commented 1 day ago

Of course it's rare to have an image that starts somewhere other than 0, but in my case I actually have a Z80 image that downloads to a 8035. So that's why I was looking at the 'c' command to start at 0x5400. romset.bin.zip

nejohnson commented 1 day ago

OK, thanks, I think I have an idea or two. In the meantime you could try the tail trick?

nejohnson commented 20 hours ago

This should now be fixed in commit 9633dae.

nejohnson commented 19 hours ago

Testing with your romset.bin with the command file

fromset.bin
>5400
c0000
e01ff

produces this:

   dasm48 -- Intel MCS-48 (8048, 8049) Disassembler --
-----------------------------------------------------------------

;   Processing "romset.bin" (49152 bytes)
;   File offset: 0x5400
;   Disassembly start address: 0x0000
;   String terminator: 0x00

___CL_0001:
    0000:    E5             SEL      MB0
    0001:    04 0E          JMP      0000EH
    0003:    15             DIS      I
    0004:    00             NOP      
    0005:    00             NOP      
    0006:    93             RETR     
    0007:    35             DIS      TCNTI
    0008:    00             NOP      
    0009:    00             NOP      
    000A:    93             RETR     
    000B:    02             OUTL     BUS, A
    000C:    05             EN       I
    000D:    61             ADD      A, @R1
    000E:    27             CLR      A
    000F:    3A             OUTL     P2, A
    0010:    15             DIS      I
    0011:    35             DIS      TCNTI
    0012:    65             STOP     TCNT
    0013:    55             STRT     T
    0014:    75             ENT0     CLK
    0015:    E5             SEL      MB0
    0016:    23 10          MOV      A, #010H
    0018:    D7             MOV      PSW, A
    0019:    A5             CLR      F1
    001A:    B5             CPL      F1
    001B:    23 7F          MOV      A, #07FH
    ... etc ...