how to use sh4dis.exe - Версия для печати +- DC-SWAT Forum (http://www.dc-swat.ru/forum) +-- Форум: Sega Dreamcast (/forum-2.html) +--- Форум: English section (/forum-29.html) +--- Тема: how to use sh4dis.exe (/thread-3678.html) |
how to use sh4dis.exe - kof888 - 09.02.2020 08:08 Hello, everyone. Recently, I found a program written by SWAT in the hard disk I checked the help file: SH4 Disassembler v1.0 by SWAT Usage: sh4dis [flags] filename Flags: -b<address> Binary file, text start -o<filename> File to write output to (default: stdout) -d Standard displacement But I can't output bin file. Is my TXT file wrong? Txt: Example L8c010000: nop nop nop nop nop nop mov.l #H'ff00001c,r0 mov.l @r0,r1 mov.l #H'000089af,r2 and r2,r1 mov.w #H'0800,r2 or r2,r1 mov.l r1,@r0 mov.l #H'8c05e760,r0 jmp @r0 nop RE: how to use sh4dis.exe - megavolt85 - 09.02.2020 08:51 Disassembler - binary to assembler conversion input bin file, output text for asemblity use Код: sh-elf-as --little -o obj.o input.s RE: how to use sh4dis.exe - kof888 - 09.02.2020 10:54 thank you~ So this can't be converted from txt to bin? input txt file, output bin file? RE: how to use sh4dis.exe - megavolt85 - 09.02.2020 19:45 no, sh4dis.exe only for convert from bin to txt for convert txt to bin use sh-elf compiler RE: how to use sh4dis.exe - kof888 - 20.02.2020 15:37 Thank you. I saw two programs sh4dis.exe and sh4disasm.exe. I thought they could be used to convert ASM to elf RE: how to use sh4dis.exe - kof888 - 18.03.2020 17:27 Sorry, I'll reply to the post again I've learned to use sh elf as and sh elf objcopy, but I'd like to ask about the writing method There is no problem in the compilation of general assembly instructions, but writing instructions containing addresses either prompts an error or compiles an error. Can you tell me how to write? For example, there are no problems with the following mov.b @r2+, r0 mov.b r0, @r3 Add #1, R3 TST R0, R0 BF loc_C Mov R3, R0 And #3, R0 Mov #0, R2 cmp/eq #0, r0 BT loc_38 cmp/eq #1, r0 BT loc_2C cmp/eq #2, r0 BT loc_30 cmp/eq #3, r0 BT loc_34 is ok~ But I don't know how to write The following mova @(h'44,pc), r0 ; [0000004C] = h'8Cf14000 mov.l @(h'44,pc), r0 ; [8C0B757C] = sub_8C08D100 mov.l #h'41474553, r5 thank you for your reply~ RE: how to use sh4dis.exe - megavolt85 - 18.03.2020 17:52 (18.03.2020 17:27)kof888 писал(а): But I don't know how to write The following Код: mova @(0x44,pc), r0 example: Код: mova .value, r0 ! r0 = adress of value Код: mov.l .value, r0 ! r0 = 0x41474553 RE: how to use sh4dis.exe - kof888 - 18.03.2020 18:08 thank you~ How to write if it is several consecutive? mov.l @(h'44,pc), r0 ; [8C0B757C] = sub_8C08D100 mov.l @(h'44,pc), r1 ; [8C0B757C] = sub_8C08D104 mov.l @(h'44,pc), r2 ; [8C0B757C] = sub_8C08D108 Is it read in order? mov.l .value, r0 mov.l .value, r1 mov.l .value, r2 mov.l .value, r3 .value: .long 0x41474553 .long 0x8c010000 .long 0x8c010004 .long 0x8c010008 anf Warning: misaligned data, How to fill the alignment if there is no 4-byte alignment at the end? Do you need to add a NOP manually? RE: how to use sh4dis.exe - megavolt85 - 18.03.2020 18:42 (18.03.2020 18:08)kof888 писал(а): Is it read in order? no Код: mov.l .value1, r0 Цитата:MOV.L @(disp, PC), Rn RE: how to use sh4dis.exe - kof888 - 18.03.2020 19:02 Thanks for your reply. I used to play the machine code by hand about MOV.L @(disp, PC), Rn,I know what it means I KONW,NOP will be added automatically. Thank you for your answer RE: how to use sh4dis.exe - megavolt85 - 18.03.2020 20:54 Код: mova .value, r0 RE: how to use sh4dis.exe - kof888 - 19.03.2020 04:38 Thank you very much, I love this program so much, I love you too ^6^ RE: how to use sh4dis.exe - kof888 - 19.03.2020 07:46 I found a problem. I don't know if it's a bug or a mistake mov.w .value1, r2 cmp/eq r2, r6 add #-0xA, r0 mov #0x1F, r2 and r2, r6 add #0xD, r6 mov #0xA, r2 shld r2, r1 mov #-0xE, r2 mov r1, r6 shld r2, r6 mov.l .value2, r2 lds.l @r15+, pr rts nop .align 2 .value1: .short 0x3FF .value2: .long 0x3FFFF .end ; mov.l .value2, r2 This one will go wrong Код: 0E922036F6701FE229260D760AE22D41F2E213662D46 02D2 264F 0B00 0900 0900 FF03 0000 FFFF0300 If this instruction is swapped forward or backward, there will be no error Did I write it wrong? RE: how to use sh4dis.exe - megavolt85 - 19.03.2020 19:10 value2 not aligned to 32 bits you set .align 2 and put short short is 2 bytes, after short you place long 8c010000 FF 03 ! value1 8c010002 FF FF ! value2 8c010004 03 00 if you read long from 8c010002 it's generate exception long can be read only from 8c01000x, where x is 0, 4, 8 or C Код: mov.w .value1, r2 RE: how to use sh4dis.exe - kof888 - 20.03.2020 03:36 Thanks for the reply,I konw ~ Does the software help explain the problem of writing grammar? RE: how to use sh4dis.exe - kof888 - 10.04.2020 16:38 Sorry, I encountered new problems with this program I would like to ask in this case, can that address be calculated automatically in .value0 mov r4, r3 mov #0, r0 cmp/eq r0, r6 bt loc_60330BA mov #0xC, r0 cmp/gt r0, r6 bf loc_60330B0 neg r5, r0 add #4, r0 and #3, r0 tst r0, r0 bt loc_603304C mov r0, r1 loc_6033040: mov.b @r5+, r0 dt r1 mov.b r0, @r4 add #-1, r6 add #1, r4 bf loc_6033040 loc_603304C: mov r6, r2 shlr2 r2 tst r2, r2 bt loc_60330A4 mov r4, r0 and #3, r0 mov r0, r1 mova .value0, r0 mov.b @(r0,r1), r1 add r1, r0 jmp @r0 nop ! --------------------------------------------------------------------------- ! --------------------------------------------------------------------------- .value0: !!!!!!!! Is there a way to calculate these few bytes automatically? .byte 0x04 .byte 0x24 .byte 0x12 .byte 0x24 ! --------------------------------------------------------------------------- ! --------------------------------------------------------------------------- loc_6033068: ! CODE XREF: sub_6033024+4Cj mov.l @r5+, r0 dt r2 mov.l r0, @r4 add #4, r4 bf loc_6033068 bra loc_60330A4 nop loc_6033078: mov.l @r5+, r0 dt r2 mov.w r0, @(2,r4) shlr16 r0 mov.w r0, @r4 add #4, r4 bf loc_6033078 bra loc_60330A4 nop loc_603308C: mov.l @r5+, r0 dt r2 mov.b r0, @(3,r4) shlr8 r0 mov.b r0, @(2,r4) shlr8 r0 mov.b r0, @(1,r4) shlr8 r0 mov.b r0, @r4 add #4, r4 bf loc_603308C loc_60330A4: mov r6, r0 and #03, r0 tst r0, r0 bt loc_60330BA mov r0, r6 loc_60330B0: mov.b @r5+, r0 dt r6 mov.b r0, @r4 add #1, r4 bf loc_60330B0 loc_60330BA: rts mov r3, r0 RE: how to use sh4dis.exe - megavolt85 - 10.04.2020 19:20 Код: mov r4, r3 if it's alrady edited code then calculate offset before you edit code RE: how to use sh4dis.exe - kof888 - 10.04.2020 20:24 Thanks for your reply, every time you can reply me at the first time now,Finally no need to calculate manually thank you very much! |