OSDev.org

The Place to Start for Operating System Developers
It is currently Mon May 20, 2024 12:12 pm

All times are UTC - 6 hours




Post new topic Reply to topic  [ 1 post ] 
Author Message
 Post subject: Freezing while start run exe file
PostPosted: Fri Sep 03, 2004 11:00 pm 
My PC freeze while I´m trying to load exec function in TASM in BP7
please could anyone help me, when freeze I press CTRL+ALT+DEL to reboot pc
I´m using only MSDOS 7 From Windows 98

{$L EXEC.OBJ}
Here is the EXEC.ASM, in pascal -> procedure exec(address : Word); Near; External;

.MODEL TPASCAL

.CODE

PUBLIC EXEC                           ; Exec function

EXEC PROC NEAR
      PUSH BP                          
      PUSH DS                          
      POP  ES                          
      MOV  BP, SP
      XOR  BX, BX
      JMP RelocateEXE

RelocateEXE:
      MOV AX, [BP+04]                       ; Adress of EXE file in pascal
      PUSH ES
      MOV ES, AX
      ADD  AX, [ES:0008h]                    ; ax = image base
      MOV  CX, [ES:0006h]                    ; cx = reloc items
      MOV  BX, [ES:0018h]                    ; bx = reloc table pointer

      JCXZ RELOCATIONDONE

RELOCYCLE:
      MOV  DI, [ES:BX]                       ; di = item ofs
      MOV  DX, [ES:BX+2]                     ; dx = item seg (rel)
      ADD  DX, AX                            ; dx = item seg (abs)
        
      PUSH DS
      MOV  DS, DX                            ; ds = dx
      ADD  [ES:DI], AX                       ; fixup
      POP  DS

      ADD  BX, 4                             ; point to next entry
      LOOP RELOCYCLE

RELOCATIONDONE:

      MOV  BX, AX
      ADD  BX, [ES:000Eh]
      MOV  SS, BX                            ; ss for EXE
      MOV  SP, [ES:0010h]                    ; sp for EXE

      ADD  AX, [ES:0016h]                    ; cs
      PUSH AX
      PUSH WORD [ES:0014h]                   ; ip
      JMP RUN
RUN:
      RETF
      POP ES
      POP BP                                
      RET 4
EXEC ENDP
END


Top
  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 1 post ] 

All times are UTC - 6 hours


Who is online

Users browsing this forum: Bing [Bot], SemrushBot [Bot] and 19 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group