Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Geek Culture / C and In-line ASM?

Author
Message
TKF15H
21
Years of Service
User Offline
Joined: 20th Jul 2003
Location: Rio de Janeiro
Posted: 28th Feb 2004 20:52 Edited at: 28th Feb 2004 21:19
I'm trying to learn how to use Dev-C and I'm stuck
with this code:

It doesn't work (says _asm wasn't defined). So,
if this isn't how in-line asm is used, then how?

I'm doing this because Dev-C++ doesn't have graph.h
(microsofts's graphics header) so I need to change
screen resolutions using the bios. Is this necessary,
or is there a graphics header I don't know about?

(1 + 2 + 3 + 4)^2 =(1^3)+(2^3)+(3^3)+(4^3)
100=1+8+27+64
IanM
Retired Moderator
22
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 28th Feb 2004 21:34
Gnu assembly language is different from the Visual C++ stuff

You can find a brief summary here

For free Plug-ins, source and the DBPro Interface library for Visual C++ 6 and .NET
http://www.matrix1.demon.co.uk
TKF15H
21
Years of Service
User Offline
Joined: 20th Jul 2003
Location: Rio de Janeiro
Posted: 28th Feb 2004 21:48 Edited at: 28th Feb 2004 21:52
Thank you, IanM.
Now I get a different error.


"suffix or operands invalid for `int'.
what's wrong now? I didn't see anything on that link about the
int...
[edit] I managed to compile this seperatly under debug.com, so there shouldn't be anything wrong with the asm code itself.

(1 + 2 + 3 + 4)^2 =(1^3)+(2^3)+(3^3)+(4^3)
100=1+8+27+64
IanM
Retired Moderator
22
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 28th Feb 2004 22:21
Did you read the sections 'Source and destination ordering' and 'Immediate operand'?

GNU inline assembly is *different*

For free Plug-ins, source and the DBPro Interface library for Visual C++ 6 and .NET
http://www.matrix1.demon.co.uk
TKF15H
21
Years of Service
User Offline
Joined: 20th Jul 2003
Location: Rio de Janeiro
Posted: 28th Feb 2004 22:56 Edited at: 28th Feb 2004 22:57
it really is.

now it just crashes.
do I have to change AH and AL back to their original values at
the end of the program?

(1 + 2 + 3 + 4)^2 =(1^3)+(2^3)+(3^3)+(4^3)
100=1+8+27+64
Teh Go0rfmeister
21
Years of Service
User Offline
Joined: 17th Aug 2003
Location:
Posted: 28th Feb 2004 23:00
dude... shouldnt this thread get deleted cos its a non DB/P language, my one about PHP/SQL did

http://www.tinnedhead.tk under re-construction.
Teh Go0rfmeister
21
Years of Service
User Offline
Joined: 17th Aug 2003
Location:
Posted: 28th Feb 2004 23:01
nothin personal against tkfish or nethin, just makin a point

http://www.tinnedhead.tk under re-construction.
TKF15H
21
Years of Service
User Offline
Joined: 20th Jul 2003
Location: Rio de Janeiro
Posted: 28th Feb 2004 23:06
It's the general section. It doesn't have to be DBP related.
I don't know why your thread was deleted. I've seen lots of
threads here about VB/PHP/C++ so maybe it was just a mistake?

(1 + 2 + 3 + 4)^2 =(1^3)+(2^3)+(3^3)+(4^3)
100=1+8+27+64
IanM
Retired Moderator
22
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 28th Feb 2004 23:06
All that I can do is guess for you ... um, yes.

Y'see, I don't use inline assembly myself. The compiler is going to have used the registers for various things, so it's probably best to push any registers that you are going to change on the stack, and pop them back into the registers later.

For free Plug-ins, source and the DBPro Interface library for Visual C++ 6 and .NET
http://www.matrix1.demon.co.uk
TKF15H
21
Years of Service
User Offline
Joined: 20th Jul 2003
Location: Rio de Janeiro
Posted: 29th Feb 2004 00:26

I copied AH and AL, then retored them at the end.
Still crashes.

(1 + 2 + 3 + 4)^2 =(1^3)+(2^3)+(3^3)+(4^3)
100=1+8+27+64
Surreal Studio IanG
21
Years of Service
User Offline
Joined: 21st Sep 2003
Location: Cyberspace...I think
Posted: 29th Feb 2004 14:06
give up

Flick that switch...*BANG*...Not that one!
TKF15H
21
Years of Service
User Offline
Joined: 20th Jul 2003
Location: Rio de Janeiro
Posted: 29th Feb 2004 17:12
I found out why this crashes: It's a DOS only thing.
If the program is run with compatibility for windows 95,
the resolution changes. Then it crashes.

Is there any other way to do this? I wanted to use something
very basic and simple. In other words, no DirectX or SDL or OpenGL.
Are there any libraries that you simply include as a header?
I can't use one that's only a wrapper for a DLL.

(1 + 2 + 3 + 4)^2 =(1^3)+(2^3)+(3^3)+(4^3)
100=1+8+27+64

Login to post a reply

Server time is: 2024-09-21 11:51:32
Your offset time is: 2024-09-21 11:51:32