C++ :: VGA VRAM Manipulation For Graphics Modes?
Jan 20, 2013
I'm trying to find the errors in my emulation of VGA VRAM concerning graphics modes.
(I'm testing it by doing plotting of all colors from x=0 to x=xsize-1 (where the color is relative, so 0=0 and xsize-1=maxcolor (in the case of 16 colors it's 15, etc.)))
VRAM Graphics management:
#include "headers/types.h" //Basic type support!
#include "headers/hardware/ports.h" //Basic PORT compatibility!
#include "headers/hardware/vga.h" //VGA data!
#include "headers/mmu/mmu.h" //For CPU passtrough!
#include "headers/hardware/vga_screen/vga_displaygeneration_crtcontroller.h" //For virtual width in bytes within VRAM!
[Code] .....
View 1 Replies
ADVERTISEMENT
Aug 25, 2014
What is the limit of a VGA with 256k VRAM, running 1bpp monochrome graphics? How high can the display resolution go?
View 3 Replies
View Related
Jul 21, 2013
I'm currently working with linear VRAM (a buffer with 256KB memory, divided into four 64k planes, so plane 0 at 0x00000, plane 1 at 0x10000, plane 2 at 0x20000, plane 3 at 0x30000). Just add the index of the plane to that for the full address in VRAM.
I'm still wondering how to get a specific pixel from VRAM (x,y coordinate) when doing graphic modes (none color modes work, only the black/white pixels (1-bit) graphic mode works).
how I can get specific pixels from the VGA VRAM (having linear access described above) using Shift Register Interleave mode (VGA modes 4&5), 16-bit planar mode (Most VGA modes) etc.
View 4 Replies
View Related
Jan 21, 2013
tell me where the errors in the below code are?
Extra info:
getrowsize() gives the size of a row in bytes (see VGA CRTC register).
getVRAMMemAddrSize() gives the size of a pixel in memory (1=byte,2=word,4=dword)
set/getBitPlaneBit(startaddr,plane,offset,bit[,on when writing]) sets/gets a bit on a specific bit plane offset (start addr is the start address register from VGA,
plane is the plane to read/write,
offset is the offset within the plane,
bit is the bit to read/write (0-7),
[on(when writing) is the value of the bit)]
[code]....
View 2 Replies
View Related
Feb 14, 2015
I am struggling with a project right now and I was wondering if there was a quick way to find multiple modes in a map. So far I have a function that returns a vector of one or many modes depending on the map. I can't seem to wrap my head around how to test it->second against other seconds to find the one that occurs most often.
vector<double> mode(vector<double>& input) {
map<double, double> tester;
vector<double> mode;
[Code] ....
View 2 Replies
View Related
May 22, 2014
I am in the process of writing a function that will blend two images using different blending modes. I have so far managed to implement overwrite (where i simply copy the source to the destination, including overwriting the alpha channel) and the Porter-Duff OVER mode (src OVER dst). It took quite a bit of searching but i finally found a reasonable algoritm:
//s = src, d = dst, f = final
//rgb = color, a = alpha
af = as + ad - asad;
rgb's = rgbsas; rgb'd = rgbdad;
rgb'f = rgb's + rgb'd(1-as); //src OVER dst
rgbf = rgb'f / af
I am looking for a similar algorithm for other Porter-Duff functions -- essentially, a replacement for line 5 above. I have read the original paper and some other literature on the subject but have not found an actual formula. I am particularly interested in the XOR mode and naively tried doing something like rgbf = rgbs ^ rgbd but that did not work at all.
View 2 Replies
View Related
Mar 25, 2014
Basically i need to encrypt a message into ascii values & i also need to allow the user type some ascii values thus decrypting the values into characters that are placed within the code.
#include <iostream>
#include <iomanip>
#include <cstring>
#include <string>
using namespace std;
#define Q 2000
void main(){
char array1[Q]={"A gentle, dull flickering flame, burns in the marble hearth. Its dim light scarcely illuminates the small, cozy room with its quiet elegance. The dismal light plays softly causing shadows over the solitary figure of a wooden desk at which Allen was roaming through his memories. Thinking back in the past where he once had a friendship which was out righteously incredible. She was the girl of his dreams, in a way which she had everything he had ever sought out in a beautiful and clever girl. Most of all she had his heart. Her style was incredible in the way the outfits she would wear would match perfectly giving a deep vibrant lively feeling."};
int S[Q];
char S1[Q];
int x;
int i;
char e, d;
cin>>x;
if(x=d){
cin>>Q;
for(i=0;i<array1[Q];i++)
cout << S[i]<<endl;
for(i=0;i<array1[Q];i++)
cout << S[i]<<endl;
}
View 18 Replies
View Related
Mar 3, 2013
I am having trouble understanding the mantissa of a floating point number. I have divided up the floating point number into the sign bit, the exponent and the mantissa, I have found the exponent, but I am not sure what to do with the mantissa? From what I have gathered so far i divide the mantissa by ten until I get a number between 1 and 10. after that i convert the number into a decimal with everything after the decimal point (or radix) being a fractional number. But when I do that on paper I dont get my intended number. How do i put the exponent and mantissa together to make a decimal from my floating point?
ex. input is 00111010000111111111011000001000
sign is 0
exponent is 01110100 which is 64+32+16+4-127=-11
mantissa is 00111111111011000001000 which would be 1.11111111011000001
When i convert that i get 1.99756622314 i dont know what to do with the -11 exponent and the answer i want is 6.1e-4
View 1 Replies
View Related
Jan 3, 2013
Array Manipulation - Transpose of a Square Matrix: This program reads a matrix (two dimensional array), displays its contents, transposes it and then displays the transposed matrix. And here's the code
Code:
#include <iostream.h>
const int arraySize = 3;
void readMatrix(int arr[][arraySize]);
void displayMatrix(int a[][arraySize]);
void transposeMatrix(int a[][arraySize]);
[Code] ....
When I compile the program it says 'mail' must return 'int' I think everything is right...
View 2 Replies
View Related
Dec 10, 2013
I need a large string vector for file content manipulation.
v1.max_size() gives me 153 391 689.
But if I make a test by looping a vector pushing back strings it crashes around 16 - 26 000 000 though I still have a lot of ram (1GB left).
How come and why isn't vector size limited by ram instead?
View 11 Replies
View Related
Mar 24, 2013
Why my output screen for this program does not want to stay open. It only opens for a split of a second and it's gone. The program is supposed to take numbers from a input file and display and save the manipulation in the output file. Here is the program.
Code:
#include<iostream>
#include<fstream>
#include<iomanip>
usingnamespace std;
[Code] ....
View 6 Replies
View Related
Feb 15, 2012
I have the following function I would like to convert to work with std:string. I don't understand QT strings at all.
Code:
void FromHexString(const QString &hexText, void* pData, int dataSize) {
for (int i = 0; i < hexText.length(); ++i) {
bool ok = false;
((uint8_t*)pData)[ i ] = hexText.mid( 2*i, 2 ).toInt( &ok, 16 );
}
}
View 1 Replies
View Related
Apr 26, 2013
Consider a program that simulates a card game, with multiple player hands and a deck to draw from. Each hand can use an array to represent the cards it contains; sometimes it is useful to also declare an additional variable for each hand (or deck) indicating exactly how many cards are present.
1) Describe a simple function that would manipulate both the array representing a hand and the number indicating the size of the hand.
2) Describe a simple function that might be able to manipulate the array without referring to the hand size variable at all.
3) Generally, if the array was passed as a parameter to a function, how often would the hand size be included as a parameter?
View 2 Replies
View Related
Jan 29, 2013
I wrote a template class for Matrix manipulation. The compiler cannot compile the source and complains
Matrix.h:144:41: error: expected initializer before ‘const’
What is the problem of the code enclosed below?
#ifndef MATRIX_H
#define MATRIX_H
/**
* @file Matrix.h
*The Matrix template class written for simplify the matrix manipulation.
*/
#include <cassert>
using namespace std;
template<typename T>
class Matrix {
int rows,cols;
[Code] .....
View 6 Replies
View Related
Dec 5, 2012
I work on a system that communicates with other systems via messages. Those messages are defined in a spec and every word must be exactly as defined. To accomplish this Ada allows me to define the fields of my record to specific words in memory.
Code:
word = 4;
type Msg_Type1 is record
x: Some_Type;
y: Another_Type;
z: Another_Type;
end record;
[Code] ....
View 5 Replies
View Related
Jul 7, 2014
So I've got a sensor (contains a gyroscope, accelerometer, and magnetometer) that outputs quaternion data. I'm looking to take that data and use it to display the rotation of my sensor in the form of some object on the screen. I've seen instances where programs use a cube, but I'm hoping to figure out a way to have a little more control over what the object I'm rendering is.
how to get started? Are there any software packages that might be able to accomplish this?
View 1 Replies
View Related
Oct 18, 2013
I use visual studio 2012. When I asked what I should use in order to put graphics into my program, I was told by the community that SFML works well. My only problem is that now I have SFML, where and how do I unpack it?
View 6 Replies
View Related
Nov 27, 2014
I'm new to c++ So I have a project to make. I need to make a cursor like an arrow that will move when inputs are given. e.g if input is given 500 spaces UP it will move up and so on. it should rotate as well like 45 degrees and so on. how to make this arrow WITHOUT USING GRAPHICS.
View 2 Replies
View Related
Nov 25, 2014
I have been learning Direct3D for a while now (DX11), and I ran into a bit of a dead end. I have Frank Luna's book on D3D programming, but I feel like I could find a better tutorial out there. I am at the point of writing the vertex shader (the first one he goes over)
Currently, I am using .fx files to write the shaders. Is that right?
View 10 Replies
View Related
Jan 6, 2013
How do I use 3D graphics .obj files created with UDK in a C++ project?
View 1 Replies
View Related
Feb 26, 2013
I am new to grpahics progamming in/under Borland C. I have included the "graphics.h" header file but i am unable to take input on the screen. If I try to move my cursor to a specified position using gotoxy() function the pointer doesnt moves to the specified location and starts taking input at (1,1) coordinate.
View 1 Replies
View Related
Nov 22, 2013
Looking for the binary search program using c Graphics....
View 5 Replies
View Related
Mar 20, 2013
I am trying to produce a image using GD graphics library. I can succesfully display my image, however I cant display this image along with a printf function too?
Code:
#include <stdio.h>
#include <gd.h>
int display_picture()
{
gdImagePtr gdImage = gdImageCreate( 50, 50 );
FILE *jpgFile = NULL;
[Code] ....
The picture displays but not hello.
View 5 Replies
View Related
Apr 24, 2014
Ive been experimenting with 3d graphics by using SDL only and lines to draw 3d shapes (no OpenGL or extension libraries, just pure math),
Ive used this page mainly to guide me on perspective projection but i have no luck [URL] ....
Ive been trying to draw a cube, but instead it gives me a mirrored dual triangular pyramids
This code here rotates the object as seen from the equations in this link: [URL] ....
double aX, aY, aZ;
for ( i = 0; i < model->qLength; i++ ) {
for ( j = 0; j < 4; j++ ) {
aX = model->quadArr[i].pointArr[j].x;
aY = model->quadArr[i].pointArr[j].y;
aZ = model->quadArr[i].pointArr[j].z;
[Code] .....
generally, i project it onto a 2d plane using: [URL] .....
double dx, dy, dz, dX, dY, dZ;
int bx, by, bX, bY;
for ( i = 0; i < model->qLength; i++ ) {
for ( j = 0; j < 4; j++ ) {
[Code] .....
I understand that my code is very messy and unoptimized, but im just concentrating on getting the core concepts to work with my code
View 1 Replies
View Related
Aug 26, 2013
I'm trying to create a GUI with Open graphics Libraries.I have made a basic GUI that exits the program or shows the instructions if a option/Polygon is marked (A bigger one is behind them)But what I'm trying to do now is the following:
0. Start the direct access on the desktop
1. Screen: Press any key to continue
2. Select one option
2.1 Option one: Go to the circuit selection menu
2.1 Option two: View the instructions (Cleared)
2.1 Option three: Exit the game (Cleared)
3. Select a circuit
4. Go to the car selection menu
5. Select a car and start the race
6. Pause menu if Spacebar has been pressed
From the pause menu:
6.1. Go to the main menu
6.2. Restart the race
6.3. Exit
I know that it is OpenGL, but what i'm looking for is C++.How I could do that? What I have cleared is with IF but I'm looking for better alternatives.
View 1 Replies
View Related
May 27, 2014
Lets say that I try and make a BASIC game with c++, how do I make the animations/graphics for the game (i.e the characters ) Do I need a specific complier/ide (I am using visual studio)
View 11 Replies
View Related