X-Authentication-Warning: delorie.com: mail set sender to djgpp-bounces using -f Date: Tue, 01 Nov 2005 14:44:40 -0500 From: Diego Cueva Subject: RE: Why the call instruction points 2 bytes before to the real start sub-routine ? In-reply-to: <001d01c5df15$d8384200$6401a8c0@SPRITELY> To: djgpp AT delorie DOT com Message-id: <003501c5df1c$b3f4a440$2432a8c0@dcueva> MIME-version: 1.0 X-MIMEOLE: Produced By Microsoft MimeOLE V6.00.2800.1409 X-Mailer: Microsoft Outlook, Build 10.0.4024 Content-type: text/plain; charset=US-ASCII Importance: Normal X-Priority: 3 (Normal) X-MSMail-priority: Normal Content-Transfer-Encoding: 8bit X-MIME-Autoconverted: from QUOTED-PRINTABLE to 8bit by delorie.com id jA1Jkne9019086 Reply-To: djgpp AT delorie DOT com Errors-To: nobody AT delorie DOT com X-Mailing-List: djgpp AT delorie DOT com X-Unsubscribes-To: listserv AT delorie DOT com Precedence: bulk Thanks for your response. Now I am using a 32 bit disassembler: 00000000 90 nop 00000001 E80B000000 call 0x11 00000006 66BE5C01 mov si,0x15c 0000000A E834000000 call 0x43 0000000F CD20 int 0x20 00000011 6650 push ax 00000013 6653 push bx 00000015 6651 push cx 00000017 6652 push dx 00000019 B406 mov ah,0x6 0000001B B000 mov al,0x0 0000001D B500 mov ch,0x0 This dis-assembled code is correct, but when I run the program does not work fine. The program act as a 16 bit code, this mean that the 1st CALL instruction, jump to 010F. In other words, this compiled program only execute: 100. - NOP 101. - CALL 010F (jump really to 10F not to 0x11) 10F. - INT 0x20 :( That's all. Exists any instruction to say to the processor that the next code is 32 bits? Thanks a lot. Att. Diego Cueva. PS. I do not know how I can do post via newsgroup. -----Original Message----- From: donthave [mailto:donthave AT noreply DOT bit] Sent: Tuesday, November 01, 2005 13:56 To: dcueva AT todo1 DOT com Subject: RE: Why the call instruction points 2 bytes before to the real start sub-routine ? Your disassembler appears to be 16-bit. It needs to be 32-bit. ndisasm -b32 ipl.s 00000000 90 nop 00000001 E80B000000 call 0x11 00000006 66BE5C01 mov si,0x15c 0000000A E834000000 call 0x43 0000000F CD20 int 0x20 Rod Pemberton PS. I attempted to post via newsgroup, but it didn't make it. Could you post this to the group? Thanks. -----Original Message----- From: dcueva AT todo1 DOT com Sent: Tuesday, November 01, 2005 12:45 To: 'djgpp AT delorie DOT com' Subject: Why the call instruction points 2 bytes before to the real start sub-routine ? Hi: Please help me with the next issue: In the next assembler program: ====================== ipl.s ================ .code32 .text .global start start: nop # Clear screen call clrscr # Print Hello world movw $m1, %si call impstr # End int $0x20 # Clear screen code using assembler clrscr: pushw %ax pushw %bx pushw %cx pushw %dx movb $6, %ah movb $0, %al movb $0, %ch movb $0, %cl movb $24, %dh movb $79, %dl movb $7, %bh int $0x10 popw %dx popw %cx popw %bx popw %ax ret # Putchar using assembler ( ...more code here...) ============================================= I am using the compiler in this way (to generate a ipl.com file or pure code machine file): ..\..\tools\as -o ipl.o ipl.s ..\..\tools\ld -m i386go32 -Ttext 0x0100 -s --oformat binary -o ipl.com ipl.o When I compile using ".code16" at the top of the code, the ipl.com file works very fine, that I expected (clear the screen, print "Hello world\n" and end). But if I omit, or put explicit ".code32", at the top of the file, the ipl.com file has the next problem: 1579:0100 90 NOP 1579:0101 E80B00 CALL 010F 1579:0104 0000 ADD [BX+SI],AL 1579:0106 66 DB 66 1579:0107 BE5C01 MOV SI,015C 1579:010A E83400 CALL 0141 1579:010D 0000 ADD [BX+SI],AL 1579:010F CD20 INT 20 NOTE!!! CALL 010F: Must point to the "clrscr" subroutine, but this subroutine start at 0111. CALL 0141: Must point to the "impstr" subroutine, but this subroutine start at 0143. Note 2 bytes of displacement in the CALL instruction. Obviously the ipl.com file compiled with .code32 does not work fine. 010F points directly to INT 0x20 :( :'( Thanks a lot for your help and time. Att. Diego Cueva. PD: I can accept a RTFM as a response, but say me the section or page. TODO1 SERVICES, INC. -TODO1- es la propietaria de la información contenida en este mensaje y sus anexos, que puede tener carácter confidencial y ha sido enviada para uso exclusivo del destinatario intencional. Si usted ha recibido este mensaje por error, por favor informe de ello al remitente a la mayor brevedad y elimine este mensaje y sus anexos. Está prohibido su uso, distribución, divulgación o almacenamiento, salvo autorización escrita de TODO1. Todo mensaje enviado y/o recibido por TODO1 es monitoreado por motivos operativos y actuando de acuerdo con prácticas de negocio y de seguridad legítimas. TODO1 SERVICES, INC. -TODO1- is the proprietary of the information contained herein and its attachments, that may have confidential character and has been sent to the intended recipient only. If you are not the intended recipient, please contact the sender immediately by replying to this e-mail and delete the message and its attachments. The use, forward, disclosure, record or retention of this message for any purpose whatsoever, is strictly prohibited, unless prior written authorization from TODO1. E-mails to and from TODO1 are monitored for operational reasons and in accordance with lawful business and security practices.