473,406 Members | 2,713 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

Help with assembler thing

Hello everyone,

I've just learned C++ a bit, and i think a good exercise would be to make a
small game(after having made the hello world examples etc.)
I've read quite a bit about setting screen modes and stuff using assembler,
and I understand it all, but I can't get it to work in Dev-Cpp. This is the
first bad part of the code I'm using:

//Header stoof

#include <cstdlib>
#include <iostream>
#include <DOS.H>
#include <MEM.H>
#include <STDLIB.H>
#include <STDIO.H>

using namespace std;

//Variable declarations
unsigned char Pall[256][3];
unsigned char *vaddr = NULL;

/*some working functions go here*/

//MCGA functions
void SetMCGA() {
_AX = 0x0013;
geninterrupt (0x10);
}

void SetText() {
_AX = 0x0003;
geninterrupt (0x10);
}

It goes wrong at SetMCGA, telling me that the variable _AX isn't defined.
How do I solve this?
I'm using Dev-Cpp for Windows.
Jul 23 '05 #1
4 1731
Familie Smeding wrote:
Hello everyone,

I've just learned C++ a bit, and i think a good exercise would be to make a
small game(after having made the hello world examples etc.)
I've read quite a bit about setting screen modes and stuff using assembler,
and I understand it all, but I can't get it to work in Dev-Cpp. This is the
first bad part of the code I'm using:

//Header stoof

#include <cstdlib>
#include <iostream>
#include <DOS.H>
#include <MEM.H>
#include <STDLIB.H>
#include <STDIO.H>

using namespace std;

//Variable declarations
unsigned char Pall[256][3];
unsigned char *vaddr = NULL;

/*some working functions go here*/

//MCGA functions
void SetMCGA() {
_AX = 0x0013;
geninterrupt (0x10);
}

void SetText() {
_AX = 0x0003;
geninterrupt (0x10);
}

It goes wrong at SetMCGA, telling me that the variable _AX isn't defined.
How do I solve this?
I'm using Dev-Cpp for Windows.


Yes, because it isn't defined. Solution: Define it.
I don't know what you're trying to achieve though. Do you want to use
inline assembly? This is off-topic here.

--
Matthias Kaeppler
Jul 23 '05 #2
Why would this be off-topic? After all, it's still C++, and geninterrupt();
and stuff are normal functions.
The problem is, the variable isn't defined, while all the tutorials I've
read say it should be. I've included all the files the examples use, but it
still doesn't work.
And Matthias, if you don't know what I'm trying to do, why do you reply?
Jul 23 '05 #3
Familie Smeding wrote:
Why would this be off-topic? After all, it's still C++, and geninterrupt();
and stuff are normal functions.
The problem is, the variable isn't defined, while all the tutorials I've
read say it should be. I've included all the files the examples use, but it
still doesn't work.
And Matthias, if you don't know what I'm trying to do, why do you reply?


My copy of the C++98 standard says nothing about a function called
geninterrupt(). It's probably a system-API function.
As to the variable:
There is no thing like predefined variables in C++. Either it's defined
as a constant in some header you have to include (which I doubt, since
you are trying to assign values to it), or you have to define it yourself.
By the way, which tutorials are you talking about? Maybe this one:
http://www.cprogramming.com/tutorial/tut1.html ?
From what I see, the "C++" code samples are only pseudo code and intend
that you use inline assembly features of your compiler. From any point,
this tutorial has nothing to do with C++ programming.

I suggest you read this instead, to get familiar with the language:
http://home.no.net/dubjai/win32cpptut/html/

If you want to get into game programming, use an API which abstracts
from your hardware/platform. Google for OpenGL or SDL, especially the
latter is pretty easy and straightforward to get into game programming
(it's a C API, but I guess there are C++ wrappers available).

--
Matthias Kaeppler
Jul 23 '05 #4
"Familie Smeding" <de**********@wanadoo.nl> wrote in message
news:42***********************@news.wanadoo.nl...
Why would this be off-topic? After all, it's still C++, and geninterrupt(); and stuff are normal functions.
The problem is, the variable isn't defined, while all the tutorials I've
read say it should be. I've included all the files the examples use, but it still doesn't work.
And Matthias, if you don't know what I'm trying to do, why do you reply?


I smell a troll......
--
Gary
Jul 23 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

21
by: Jure Sah | last post by:
Hello, I have been promising an object orientated ASM IDE for a while now. Trying to make the best of what is already here, I have made a compiler, that will parse XML code and output ASM files....
3
by: enfis.the.paladin | last post by:
Hi to all! I have something like this: class FWrap { public: virtual void READ (void) = 0; } class Optimized { private:
4
by: Neil Morris | last post by:
Hi I would like to know what the standard way to write a custom C library that links to assembler code? The reason is that, apart of been curious, I would like to know what format the C language...
11
by: Peter Mount | last post by:
Hello Are there any good online tutorials that explain pointers in ANSI C? I've covered pointers in my course but I'm just having trouble "getting it to sink in". Thanks Peter Mount...
5
by: Daniel Gackle | last post by:
Will Whidbey will include the ability to put inline assembler into C# code? I found a previous thread in which it was implied that a future version of .NET would support this....
14
by: spamtrap | last post by:
Mostly for testing reasons I'd like to see if it makes sense to chose the following approach for just-in-time compilation of shaders for a renderer: Seeing as the shaders themsefs consist mostly...
9
by: Ruben.Colina | last post by:
i'm trying to make a program c which use a function in assembler, can anybody help me, i'm using linux with gcc-4.1 and nasm 0.98.38: i have three files: a.c a.h espera.asm each files...
7
by: tylerca | last post by:
I'm attempting to start some process control using Python. I've have quite a bit of literature on networking, and have made some tinkering servers and clients for different protocols HTTP, FTP,...
5
by: Hunter | last post by:
Hi all, I know it may sound like dump newbie question (which is very much true, as I am a newbie, not even a real programmer), but I need to implement a calendar time clock with a millisecond...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.