From: Willow on 11 Aug 2008 22:05 I just finished my very own disassembler, written from scratch. It takes a 750-line input script file that specifies the x86 and x86-64 instruction set, and produces a disassembler. Unlike other disassemblers, mine is enjoyable to work on because it is coherent, you have a script file that makes sense (to me at least :-) rather than a bunch of incoherent and often buggy opcode tables copied from an Intel manual. You should check it out and let me know what you think! It's called crudasm, the crude disassembler. Right now it only works in 16 and 32 bit mode, and only supports raw binary files (e.g. no PE etc. files). You can find it here: http://code.google.com/p/vm64dec/downloads/list I plan to update crudasm to make it more intelligent in the next release. In the future I will add floating point, MMX, SSE, etc. instructions but they're not supported yet. I will also update the script file to contain semantics not just syntax so the disassembler can be like sourcer, e.g. it knows mov ax,5 loads ax to 5, etc. Although I am proud of this, and I hope I don't get flamed for being a newbie or something...It took a lot of work to get to this point. Hopefully it's all downhill from here. You're probably wondering, why another diassembler? There is no good reason, I wrote this for the experience of developing my own tool not because the world needs another disassembler. Mine is not as good as the one that comes with nasm (less opcodes) or anything but it's my very own program! If you do download it, check out x86c/script.txt and let me know what you think... if you have any questions about what the fields mean (the script is a space-separated list) then ask me.
From: NathanCBaker on 11 Aug 2008 22:44 On Aug 11, 10:05 pm, Willow <wrschlan...(a)gmail.com> wrote: > > You can find it here:http://code.google.com/p/vm64dec/downloads/list > The program runs fine when I don't give it any parameters. But, as soon as I specify something for it to do, the thing crashes. Ollydbg shows that it is trying to read from a null pointer. Nathan.
From: Willow on 11 Aug 2008 23:08 Hi! Thanks very much for finding this bug! The problem was I was accessing an argv[] variable beyond what argc said should be accessed. It's fixed now in the latest release here: http://code.google.com/p/vm64dec/downloads/list I also fixed a bug with mov cr/dr. Now that you can actually run it... what do you think? ---Bug fix follows--- crudasm1.cpp: U4 skip = 0; if(argc >= 4) { change to: U4 skip = 0; if(argc >= 5) {
From: NathanCBaker on 11 Aug 2008 23:41 On Aug 11, 11:08 pm, Willow <wrschlan...(a)gmail.com> wrote: > > Now that you can actually run it... what do you think? I like it. But I'd like the columns to be closer together. Here is what I tested it with: [ use 'nasm etch.asm -o etch.com' to assemble ] [ Beth post this to a.l.a YEARS ago ] ; Etch.asm: ; Etch-a-sketch simulation program ; ; keys: ; a = move up ; z = move down ; , = move left ; . = move right ; s = shake etch-a-sketch (clears drawing) ; esc = quit ; org 100h mov ax, 0013h int 10h mov di, 0A000h mov es, di mov di, (99 * 320) + 159 NextPixel: mov byte [es:di], 15 mov ah, 00h int 16h cmp ah, 01h je QuitProgram cmp ah, 1Fh jne NotShake mov ax, 0013h int 10h NotShake: cmp ah, 1Eh jne NotMoveUp sub di, 320 NotMoveUp: cmp ah, 2Ch jne NotMoveDown add di, 320 NotMoveDown: cmp ah, 33h jne NotMoveLeft dec di NotMoveLeft: cmp ah, 34h jne NotMoveRight inc di NotMoveRight: jmp NextPixel QuitProgram: mov ax, 0003h int 10h ret Doing a 'crudasm1 etch.com 16 0x100 > etch.dis' gave me this: 00000100 mov ax,0x0013 00000103 int byte 0x10 00000105 mov di,0xa000 00000108 mov es,di 0000010a mov di,0x7c5f 0000010d mov byte [es:di],byte 0x0f 00000111 mov ah,byte 0x00 00000113 int byte 0x16 00000115 cmp ah,byte 0x01 00000118 je short 0x0144 0000011a cmp ah,byte 0x1f 0000011d jne short 0x0124 0000011f mov ax,0x0013 00000122 int byte 0x10 00000124 cmp ah,byte 0x1e 00000127 jne short 0x012d 00000129 sub di,word 0x0140 0000012d cmp ah,byte 0x2c 00000130 jne short 0x0136 00000132 add di,word 0x0140 00000136 cmp ah,byte 0x33 00000139 jne short 0x013c 0000013b dec di 0000013c cmp ah,byte 0x34 0000013f jne short 0x0142 00000141 inc di 00000142 jmp short 0x1010d 00000144 mov ax,0x0003 00000147 int byte 0x10 00000149 ret word 0x0000 > > ---Bug fix follows--- > crudasm1.cpp: > > U4 skip = 0; > if(argc >= 4) > { > > change to: > > U4 skip = 0; > if(argc >= 5) > { You are just setting yourself up to run into this same bug again. Better to just use one conditional or the other, not both. So, either do "if(argc > 4)" or "if(argc = 5)" so that you don't get problems latter. Nathan.
From: Willow on 12 Aug 2008 00:56
On Aug 11, 7:41 pm, NathanCBa...(a)gmail.com wrote: > On Aug 11, 11:08 pm, Willow <wrschlan...(a)gmail.com> wrote: > > > > > Now that you can actually run it... what do you think? > > I like it. But I'd like the columns to be closer together. Here is > what I tested it with: Which columns? From the script file? > You are just setting yourself up to run into this same bug again. > Better to just use one conditional or the other, not both. So, either > do "if(argc > 4)" or "if(argc = 5)" so that you don't get problems > latter. Thanks for the advice. I modified the script file so it now produces this output for the same input (notice most of the redundant sizes are no longer there): 00000100 mov ax,0x0013 00000103 int 0x10 00000105 mov di,0xa000 00000108 mov es,di 0000010a mov di,0x7c5f 0000010d mov byte [es:di],0x0f 00000111 mov ah,0x00 00000113 int 0x16 00000115 cmp ah,0x01 00000118 je short 0x0144 0000011a cmp ah,0x1f 0000011d jne short 0x0124 0000011f mov ax,0x0013 00000122 int 0x10 00000124 cmp ah,0x1e 00000127 jne short 0x012d 00000129 sub di,0x0140 0000012d cmp ah,0x2c 00000130 jne short 0x0136 00000132 add di,0x0140 00000136 cmp ah,0x33 00000139 jne short 0x013c 0000013b dec di 0000013c cmp ah,0x34 0000013f jne short 0x0142 00000141 inc di 00000142 jmp short 0x010d 00000144 mov ax,0x0003 00000147 int 0x10 00000149 ret word 0x0000 |