Project Universal Vector Graphics Computer for Orbiter

cinder1992

Random failhurricane.
Addon Developer
Tutorial Publisher
Joined
Jul 5, 2009
Messages
350
Reaction score
1
Points
0
Website
cinder1992.blogspot.com
In the temporary postponement of the Shuttle-A MK4 project due to several glitches and problems (WHEN I SAY 2 I WANT 2, NOT 90), I have separated the computer into a new project, the Universal Vector Graphics Computer for Orbiter or UVGCO for short (let's play spot the pun :D)

UVGCO is basicly a 8-bit processor emulator for orbiter. the entire project has three parts:

  1. an 8-bit porcesser emu.
  2. a BASS library sound system
  3. a Graphics processor

the processor itself will be z80 based, and will support standard z80 programs (CPM, mostly.), but it will be able to run it's own type of program as well.

as of now, this is the 4th re-write of the processing engine, the previous three were plagued by the same glitch that has postponed the Shuttle-A MK4.

I wish myself good luck in this endeavor.
 
Last edited:
OMG, sounds promising:blink:

any thoughts on how this could integrate with the existing LUA engine?
 
Actually, that was the plan. I was going to take advantage of the fact that the LUA script and the MFD were separate processes in order to have separate CPU emulation and GPU emulation.

currently, the CPU is, in fact, written in python. but I'm confident that I can port it.
 
first of all, this project is not dead yet.

second of all, screw trying to write an entire processor-emulator, the one i've written is too glitchy and tends to fail (the 2 = rnd problem, I could never pin that down...). so I'm switching to a more reliable and proven platform. it will either be a Zilog or a Motorola, i'm still deciding.

edit: It's going to be zilog Z80 based.
 
Last edited:
My vote goes for Zilog as I was always a fan of that architecture.
 
HELP NEEDED

ok, 24 hours into writing this and I've already hit a roadblock. I know NOTHING about coding for the z80 (besides some ti-basic). also, the Z80 emulator library i found absolutely refuses to run CP/M for no apparent reason (most likely due to the fact that I notice the obvious about as much as a flower notices a tree on the other side of the planet).
 
ok, 24 hours into writing this and I've already hit a roadblock. I know NOTHING about coding for the z80 (besides some ti-basic). also, the Z80 emulator library i found absolutely refuses to run CP/M for no apparent reason (most likely due to the fact that I notice the obvious about as much as a flower notices a tree on the other side of the planet).

Last time I've written a few programs in assembly for Z80/8080 based microcontroller it was something like 14-12 years ago (not counting the ZX Spectrum times some 10 years more in the past :P), and I might have forgotten things, so I'm not sure I'm able to help you now.

But maybe this page will help you (it would help me to recall things I've forgotten):

Just only Z80 microprocessor isn't an interpreter for TI-BASIC. It needs a program that would interpret it first, i.e. compile to the machine code just before execution. If you have only a Z80 without any BIOS programmed that can interpret high level language, you will need to program it in machine code, or assembly, C/C++ and use a cross-compiler for Z80, and not just a plain TI-BASIC which is a high level language.

The emulation library might not be compatible with the CP/M system you want to run with it, like a program written for ZX Spectrum won't work on a Z80 based microwave, washer or a Texas Instruments calculator.
 
I'm just reading the official Zilog manual. the address ports on the chip make my life a whole lot easer. I'm going to try this again.

edit: found another Z80 emulation library, it's C, but it should work.

edit 2: that's what i thought. its LINUX ONLY. silly author neglected to mention that on it's homepage. still, the opcode table he provided will be useful.

---------- Post added at 05:39 PM ---------- Previous post was at 04:31 PM ----------

ok, this is probably a very roundabout way of doing things, but I'm using a hex editor to write Z80 machine code using the list mentioned above. i found a z80 emulator that i'm testing code on (i don't actually need the graphics engine to know what's going on, as the Z80 and the graphics engine are as seperate as oil and water: barely touching each other).

---------- Post added 08-29-10 at 11:43 AM ---------- Previous post was 08-28-10 at 05:39 PM ----------

sorry to pop in unnanounced, but can somebody tell me what i'm doing wrong here? this bit of code isn't compiling and from my knowlage, it should.

main.cpp:
Code:
//main interface for the UVGCO Z80 compiler and emulator
// Copyright (c) Neil Ray, 2010
#include <iostream>
#include <fstream>
#include "EMU.h"																				//include the Z80 emulator functions and variables
#include "OPCODE.h"																				//include the OPCODE lookup table, this is needed to compile and run Z80 programs

int main(int argc, char *argv[])
{
	using namespace std;
	if (argc <= 1)
	{	
		cout << "Usage: " << argv[0] << " <input Filename> <output filename> <flags>. Flags can be found /n in the readme file supplied with the program" << endl;  //self explanitory :)
		return 0;
	}

	for (int nArg = 0; nArg < argc; nArg++)														//determin what settings the user wants by reading the flags
	{
		switch (argv[nArg])
		{
			case "r":																			//the RUN flag
				run = 1;
				break;
			case "c":																			//the COMPILE flag
				compile = 1;
				break;
			case "d":																			//the debug flag
				debug = 1;
				break;
			default:
				cout << "ERROR: UNKNOWN ARGUMENT. TERMINATING" << endl;							//this is going to pop up an error when an unidetified flag is set
				return 0;
				break;
		}
	}
	return 0;
}

main.h:
Code:
//main interface header for the UVGCO Z80 compiler and emulator
// Copyright (c) Neil Ray, 2010

// create three boolian values to use as argument flags in main.cpp

bool run;										//if this flag is = 1, and compile = 1, run the file designated in the argument OUTFILE
bool compile;									// read above
bool syntax;									// choose between the Intel and the Zilog syntax, this value is just a placeholder for the next version.
bool debug;

i know all it does is print stuff to the screen, but it'll do stuff when i'm finished.

EMU.h and OPCODE.h are empty.

i was trying to test the argument detection, but i have a hunch that it'll terminate without hesitation on the first argument.
 
Last edited:
Assigning integer values to bool variables?

Try run = TRUE, etc. instead

Haven't coded in C for a while, but that looks more like C++ to me...
 
If you're declaring those boolean values in main.h you'll need to #include "main.h"... which you aren't doing at the moment.

---------- Post added at 17:04 ---------- Previous post was at 16:58 ----------

that looks more like C++ to me...

It is C++, hence why the file is a .cpp file.
 
sorry to pop in unnanounced, but can somebody tell me what i'm doing wrong here? this bit of code isn't compiling and from my knowlage, it should.
It would be much easier for someone to help you figure out what's wrong if you would tell us WHY it doesn't compile--as in, the exact error message you get.
 
Assigning integer values to bool variables?

Try run = TRUE, etc. instead

Haven't coded in C for a while, but that looks more like C++ to me...

1 and 0 are boolean values, last time i checked

If you're declaring those boolean values in main.h you'll need to #include "main.h"... which you aren't doing at the moment

that doesn't need to be done in VC++ 2010. all .cpp files automaticly include .h files with the same name.

also, most of the errors are related with the "switch" command i put there, not the bool values. I'll post the whole log tomorrow.
 
Hi. Any nonzero value will evaluate to true for a boolean, so therefore converting an integer to a boolean will result in a valid conversion at the loss of performance.

Your issue is that you are trying to use the switch statement for handling string values. Switch statements are only meant for integers.
 
Hi. Any nonzero value will evaluate to true for a boolean, so therefore converting an integer to a boolean will result in a valid conversion at the loss of performance.
The performance hit for this would be negligible.

Your issue is that you are trying to use the switch statement for handling string values. Switch statements are only meant for integers.
He's attempting to use it for characters, which are perfectly valid for switch statements; however, he's using double quotes instead of single quotes. The switch statement should read:
Code:
  switch (argv[nArg])
  {
   case 'r':                   //the RUN flag
    run = 1;
    break;
   case 'c':                   //the COMPILE flag
    compile = 1;
    break;
   case 'd':                   //the debug flag
    debug = 1;
    break;
   default:
    cout << "ERROR: UNKNOWN ARGUMENT. TERMINATING" << endl;       //this is going to pop up an error when an unidetified flag is set
    return 0;
    break;
  }
Note the single quotes.
 
Instead of talking, why don't you try to compile the thing? argv is an array of char *, ie. strings. This won't do for switch statements, because they only take integral expressions as their input:

VC++ 2008 express edition said:
error C2450: switch expression of type 'char *' is illegal
1> Integral expression required

Even when using single quotes, the compiler converts the character to its integral value.
 
Last edited:
Instead of talking, why don't you try to compile the thing?
Because if he can't be arsed to copy/paste the compile error, I can't be arsed to go try to compile it myself.

argv is an array of char *, ie. strings. This won't do for switch statements, because they only take integral expressions as their input:


Even when using single quotes, the compiler converts the character to its integral value.
Instead of talking, why don't you just tell him the three characters he needs to add to fix it at this point?
Code:
  switch (argv[nArg][COLOR=red][0][/COLOR])
  {
   case 'r':                   //the RUN flag
    run = 1;
    break;
   case 'c':                   //the COMPILE flag
    compile = 1;
    break;
   case 'd':                   //the debug flag
    debug = 1;
    break;
   default:
    cout << "ERROR: UNKNOWN ARGUMENT. TERMINATING" << endl;       //this is going to pop up an error when an unidetified flag is set
    return 0;
    break;
  }
You'll probably also want to have the flags-handling loop start at 3 instead of 0 (0 is the program name, 1 is the input file, and 2 is the output file), and you'll need to do something about the input file and output file.
 
Back
Top