Assembly in VC 6 ++

Started by
17 comments, last by Bruno 23 years, 6 months ago
Kinda along the same lines, is it possible to switch to Mode 13 or Mode X using the VC++ console app? If I run a program where I switch to Mode 13 and back that I complied with Borland 3.1 I have no problem. But if I run the same program compiled under VC++ it gives me the blue screen of death.

    #include <stdio.h>void main(){  _asm {       mov ax,ax;       mov ax,0x13;       int 0x10;  }}    
"I can't work like this! Where are my fuzzy dice?"
Advertisement
Can any of you guys sent me, a little piece of code that compiles in your VC, just to check if it compiles in mine ?
I think i''m missing something here., my VC continues to refuse any assembly commands..

thanks

my email is brunomtc@hotmail.com

Bruno
Use an assembler like masm/masm32/tasm/tasm32.
Then link the obj file created by the assembler to the
obj file created by the MSVC compiler, then the MSVC
linker to spit out an exe.

Inline assembly is 10x slower than the suggestion above!
You will have a difficult time trying to link the two objects
together and i''m a bit rusty so I don''t wanna make it harder
than it is. One note, tasm and borland uses OFF,
MSVC and masm uses COFF to create the obj file.
I think MSVC will automatically convert the OFF obj to COFF,
but i''m rusty.


You can find tasm32 and masm32 for free online, but
the latest version of tasm and masm will cost some money.
I''m sure you can get an older version though.

quote:Original post by Bruno

void drawH(int ymin,int ymax,int y)
{
int i=ymin;
__asm
{
um:
mov ax,1
mov sbuffer[y],1<br> cmp i,ymax<br> jne um<br> }<br>}<br><br> <hr height=1 noshade></BLOCKQUOTE></font> <br><br>1. mov ax,1<br>Why??? You don''t use it…<br><br>2. mov sbuffer[y],1<br>3. cmp i,ymax<br>This instructions can have just 1 memory operand.<br><br>What do you want exactly?<br>Just write it in C, and we''ll translate it to inline ASM.<br>
I''m sure a ''break'' will help.






-=[ Lucas ]=-
-=[ Lucas ]=-
Hmm.. First of all: Masm is free. Even the latest versions

Second... You can''t change to mode 13h in a console app. Your application needs ring 0 priviliges (same rights as VMM), which you need a device driver in order to do. (in win9x you could do it by hijacking an interrupt, but that''s not recommended, as it is a bug and not a feature... In fact, viruses like CIH take advantage of this to give itself ring 0 rights.)

Third... What the cuckoo is your code doing? To me it seems like it gets stuck in an infinite loop... If it''d work, that is.

Try this... I think this is what you''re trying to do... But your code makes no sense, really, so I could be totally off.

    void drawH(int ymin,int ymax){    __asm    {      mov ecx, ymin      mov eax, sbuffer    um:      mov WORD PTR [eax+ecx*2],1      cmp ecx,ymax      inc ecx       jle um    }}    

quote:Original post by gi-centerprintf
Inline assembly is 10x slower than the suggestion above!


What do you mean by that? Execution speed remains the same. An asm instruction is an asm instruction is an asm instruction... Or were you thinking of something else?

quote:
You will have a difficult time trying to link the two objects
together and i''m a bit rusty so I don''t wanna make it harder
than it is. One note, tasm and borland uses OFF,
MSVC and masm uses COFF to create the obj file.

Not trying to be picky or anything, but i think it''s OMF, as in O bject M odule F ormat :D



quote:
Inline assembly is 10x slower than the suggestion above!


I too wondered about this. This effectively means that C++ implementations for some reason *change* the asm code to different asm code that is less efficient. I hate it when grossly misinformed people say things when they haven''t researched it one little bit!



-=[ Lucas ]=-
-=[ Lucas ]=-

This topic is closed to new replies.

Advertisement