inline asm problem 
Author Message
 inline asm problem

hi! i'm trying to implement asm function 7305h of interrupt 21h in my C++
program, and I just can't do it. first problem is that I have to use
structure:

DISKIO  STRUC
    diStartSector   dd  ?   ;sector number to start
    diSectors       dw  ?   ;number of sectors
    diBuffer        dd  ?   ;address of buffer
DISKIO  ENDS

and inline asm doesn't support STRUC. and I don't know how to do this using
C++ struct.

any help appreciated!



Wed, 16 Feb 2005 19:51:34 GMT  
 inline asm problem

Quote:

> hi! i'm trying to implement asm function 7305h of interrupt 21h in my C++
> program, and I just can't do it. first problem is that I have to use
> structure:

> DISKIO  STRUC
>     diStartSector   dd  ?   ;sector number to start
>     diSectors       dw  ?   ;number of sectors
>     diBuffer        dd  ?   ;address of buffer
> DISKIO  ENDS

> and inline asm doesn't support STRUC. and I don't know how to do this using
> C++ struct.

> any help appreciated!

First of all: Are you sure you can use that interrupt function with your
OS?


Wed, 16 Feb 2005 22:12:38 GMT  
 inline asm problem

Quote:
> hi! i'm trying to implement asm function 7305h of interrupt 21h in my C++
> program, and I just can't do it. first problem is that I have to use
> structure:

> DISKIO  STRUC
>     diStartSector   dd  ?   ;sector number to start
>     diSectors       dw  ?   ;number of sectors
>     diBuffer        dd  ?   ;address of buffer
> DISKIO  ENDS

The inline assembler doesn't allow you to define variables or data
structures. It does generally know how to access simple variables and
structures defined in C/C++.

Your bigger problem is that VC/C++ only generates 32 bit code segments.
Neither 9x nor NT will permit a 16 bit interrupt to take place in a 32 bit
code segment. 16 bit ISRs put the address of the return instruction into IP
and 32 bit ISRs set EIP. That's a quick trip to hyperspace.

You can either find a 16 bit compiler - I think that Borland still makes
on - to generate a 16 bit segment to run on 9x or in NT's compatibility mode
though NT is a bit 'picky' about letting you get close to the hardware.

You should take a step back, describe what you want to do and not how to do
it and someone here may propose a modern approach.

Regards.
Will



Thu, 17 Feb 2005 00:23:28 GMT  
 inline asm problem
you're right. well, i'll just post another question, with my real,initial
problem.

thanks



Thu, 17 Feb 2005 02:17:09 GMT  
 inline asm problem
yes- win95/98


Thu, 17 Feb 2005 02:13:46 GMT  
 inline asm problem
actually, nope. sorry


Thu, 17 Feb 2005 02:14:34 GMT  
 
 [ 6 post ] 

 Relevant Pages 

1. Problems with inline asm in Borland C

2. problem with inline asm in BC4.5

3. inline asm on VC6 (loading the address of a member var in a register)

4. Help with an inline asm function...please?

5. inline asm

6. about mix power c inline asm

7. gcc and usage of inline asm...

8. Inline asm in GNU C?

9. Help with inline SPARC asm ?

10. Inline-asm in C compilers?

11. Help!! Visual C++ 4.x and Inline Asm

12. Inline asm (int 10H)?

 

 
Powered by phpBB® Forum Software