Saturday, 15 February 2014

assembly - Building 16-bit code instead of 32-bit one on MASM -



assembly - Building 16-bit code instead of 32-bit one on MASM -

the problem when build 32-bit application.exe application 16-bit machine code.

here code (taken book):

.386 .model flat .const url db "http://www.lionking.org/`cubbi/", 0 .code _start: xor ebx, ebx force ebx force ebx force ebx force offset url force ebx force ebx ; phone call shellexecute force ebx ; phone call exitprocess end _start

to build application write in console

ml winurl.asm (i tried ml /c winurl.asm there no other result) link winurl.obj

then have executable file 16-bit machine code:

pu = ?86, uirtual 8086 mode, id/step = 0f62, a20 enabled 09e4:0000 33db xor bx,bx 09e4:0002 53 force bx 09e4:0003 53 force bx 09e4:0004 53 force bx 09e4:0005 680000 force 0000h 09e4:0008 0000 add together [bx+si],al 09e4:000a 53 force bx 09e4:000b 53 force bx 09e4:000c 53 force bx 09e4:000d 0000 add together [bx+si],al 09e4:000f 006874 add together [bx+si+74h],ch 09e4:0012 7470 jz short 0084

i don't need working code. want assembly application 32-bit code or want understand i'm doing wrong.

thank paying attention.

unless tell disassembler code 16-bit (or 32-bit) , unless can guess somehow (e.g. based on format of executable, if any), disassembler cannot know 1 of 2 is.

i've taken instruction bytes 16-bit disassembly , disassembled them 32-bit code:

00000000:i33db xor ebx,ebx 00000002:i53 force ebx 00000003:i53 force ebx 00000004:i53 force ebx 00000005:i6800000000 force 00000000 0000000a:i53 force ebx 0000000b:i53 force ebx 0000000c:i53 force ebx 0000000d:i0000 add together [eax],al ; 0s between code & info 0000000f:i006874 add together [eax+74],ch ; db 0,"ht" 00000012:i7470 je ; db "tp"

this right 32-bit machine code generated assembly source , you're not disasembling correctly. somehow you're disassmbling 16-bit, wrong.

assembly x86 32-bit masm32

No comments:

Post a Comment